You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
PyBitmessage/src/protocol.py

14 lines
426 B
Python

import struct
import shared
def getBitfield(address):
# bitfield of features supported by me (see the wiki).
bitfield = 0
# send ack
if not shared.safeConfigGetBoolean(address, 'dontsendack'):
bitfield |= shared.BITFIELD_DOESACK
return struct.pack('>I', bitfield)
def checkBitfield(bitfieldBinary, flags):
bitfield, = struct.unpack('>I', bitfieldBinary)
return (bitfield & flags) == flags