def _serialize_extra_payload(self): extra = self.extra_payload spec_tx_class = DeserializerDash.SPEC_TX_HANDLERS.get(self.tx_type) if not spec_tx_class: assert isinstance(extra, (bytes, bytearray)) return pack_varbytes(extra) if not isinstance(extra, spec_tx_class): raise ValueError('Dash tx_type does not conform with extra' ' payload class: %s, %s' % (self.tx_type, extra)) return pack_varbytes(extra.serialize())
def serialize(self): assert (len(self.proTxHash) == 32 and len(self.PubKeyOperator) == 48 and len(self.KeyIdVoting) == 20 and len(self.inputsHash) == 32) return ( pack_le_uint16(self.version) + # version self.proTxHash + # proTxHash pack_le_uint16(self.mode) + # mode self.PubKeyOperator + # PubKeyOperator self.KeyIdVoting + # KeyIdVoting pack_varbytes(self.scriptPayout) + # scriptPayout self.inputsHash + # inputsHash pack_varbytes(self.payloadSig) # payloadSig )
def test_pack_varbytes(): tests = [b'', b'1', b'2' * 253, b'3' * 254, b'4' * 256, b'5' * 65536] for test in tests: data = util.pack_varbytes(test) deser = tx.Deserializer(data) assert deser._read_varbytes() == test
def serialize(self): return b''.join(( self.keyimage, self.ringsize, pack_varbytes(self.script), pack_le_uint32(self.sequence), ))
def serialize(self): return b''.join(( self.prev_hash, pack_le_uint32(self.prev_idx), pack_varbytes(self.script), pack_le_uint32(self.sequence), ))
def serialize(self): assert (len(self.pubKey) == 48 and len(self.payloadSig) == 96) return ( pack_le_uint16(self.version) + # version pack_varbytes(self.userName) + # userName self.pubKey + # pubKey self.payloadSig # payloadSig )
def serialize(self): assert (len(self.ipAddress) == 16 and len(self.KeyIdOwner) == 20 and len(self.PubKeyOperator) == 48 and len(self.KeyIdVoting) == 20 and len(self.inputsHash) == 32) return ( pack_le_uint16(self.version) + # version pack_le_uint16(self.type) + # type pack_le_uint16(self.mode) + # mode self.collateralOutpoint.serialize() + # collateralOutpoint self.ipAddress + # ipAddress pack_be_uint16(self.port) + # port self.KeyIdOwner + # KeyIdOwner self.PubKeyOperator + # PubKeyOperator self.KeyIdVoting + # KeyIdVoting pack_le_uint16(self.operatorReward) + # operatorReward pack_varbytes(self.scriptPayout) + # scriptPayout self.inputsHash + # inputsHash pack_varbytes(self.payloadSig) # payloadSig )
def serialize(self): assert (len(self.proTxHash) == 32 and len(self.ipAddress) == 16 and len(self.inputsHash) == 32 and len(self.payloadSig) == 96) return ( pack_le_uint16(self.version) + # version self.proTxHash + # proTxHash self.ipAddress + # ipAddress pack_be_uint16(self.port) + # port pack_varbytes(self.scriptOperatorPayout) + # scriptOperatorPayout self.inputsHash + # inputsHash self.payloadSig # payloadSig )
def serialize(self): return b''.join(( pack_le_int64(self.value), pack_varbytes(self.pk_script), ))