MCPcopy Index your code
hub / github.com/jimmysong/programmingbitcoin / parse_legacy

Method parse_legacy

code-ch13/tx.py:118–130  ·  view source on GitHub ↗
(cls, s, testnet=False)

Source from the content-addressed store, hash-verified

116
117 @classmethod
118 def parse_legacy(cls, s, testnet=False):
119 version = little_endian_to_int(s.read(4)) # <4>
120 num_inputs = read_varint(s)
121 inputs = []
122 for _ in range(num_inputs):
123 inputs.append(TxIn.parse(s))
124 num_outputs = read_varint(s)
125 outputs = []
126 for _ in range(num_outputs):
127 outputs.append(TxOut.parse(s))
128 locktime = little_endian_to_int(s.read(4))
129 return cls(version, inputs, outputs, locktime,
130 testnet=testnet, segwit=False)
131 # end::source2[]
132
133 # tag::source3[]

Callers

nothing calls this directly

Calls 4

little_endian_to_intFunction · 0.90
read_varintFunction · 0.90
readMethod · 0.45
parseMethod · 0.45

Tested by

no test coverage detected