MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / serialize

Method serialize

test/functional/test_framework/messages.py:919–927  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

917 self.vBits.append(vBytes[i//8] & (1 << (i % 8)) != 0)
918
919 def serialize(self):
920 r = b""
921 r += struct.pack("<i", self.nTransactions)
922 r += ser_uint256_vector(self.vHash)
923 vBytesArray = bytearray([0x00] * ((len(self.vBits) + 7)//8))
924 for i in range(len(self.vBits)):
925 vBytesArray[i // 8] |= self.vBits[i] << (i % 8)
926 r += ser_string(bytes(vBytesArray))
927 return r
928
929 def __repr__(self):
930 return "CPartialMerkleTree(nTransactions=%d, vHash=%s, vBits=%s)" % (self.nTransactions, repr(self.vHash), repr(self.vBits))

Callers

nothing calls this directly

Calls 2

ser_uint256_vectorFunction · 0.85
ser_stringFunction · 0.85

Tested by

no test coverage detected