MCPcopy Index your code
hub / github.com/petertodd/python-bitcoinlib / stream_serialize

Method stream_serialize

bitcoin/core/__init__.py:398–410  ·  view source on GitHub ↗
(self, f, include_witness=True)

Source from the content-addressed store, hash-verified

396
397
398 def stream_serialize(self, f, include_witness=True):
399 f.write(struct.pack(b"<i", self.nVersion))
400 if include_witness and not self.wit.is_null():
401 assert(len(self.wit.vtxinwit) <= len(self.vin))
402 f.write(b'\x00') # Marker
403 f.write(b'\x01') # Flag
404 VectorSerializer.stream_serialize(CTxIn, self.vin, f)
405 VectorSerializer.stream_serialize(CTxOut, self.vout, f)
406 self.wit.stream_serialize(f)
407 else:
408 VectorSerializer.stream_serialize(CTxIn, self.vin, f)
409 VectorSerializer.stream_serialize(CTxOut, self.vout, f)
410 f.write(struct.pack(b"<I", self.nLockTime))
411
412 def is_coinbase(self):
413 return len(self.vin) == 1 and self.vin[0].prevout.is_null()

Callers

nothing calls this directly

Calls 2

is_nullMethod · 0.45
stream_serializeMethod · 0.45

Tested by

no test coverage detected