This repository has been archived on 2024-12-20. You can view files and clone it, but cannot push or open issues or pull requests.
PyBitmessage-2024-12-20/src/protocol.py

14 lines
426 B
Python
Raw Normal View History

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