Takes a byte stream and parses the tx_input at the start return a TxIn object
(cls, s)
| 266 | |
| 267 | @classmethod |
| 268 | def parse(cls, s): |
| 269 | '''Takes a byte stream and parses the tx_input at the start |
| 270 | return a TxIn object |
| 271 | ''' |
| 272 | # prev_tx is 32 bytes, little endian |
| 273 | prev_tx = s.read(32)[::-1] |
| 274 | # prev_index is an integer in 4 bytes, little endian |
| 275 | prev_index = little_endian_to_int(s.read(4)) |
| 276 | # use Script.parse to get the ScriptSig |
| 277 | script_sig = Script.parse(s) |
| 278 | # sequence is an integer in 4 bytes, little-endian |
| 279 | sequence = little_endian_to_int(s.read(4)) |
| 280 | # return an instance of the class (see __init__ for args) |
| 281 | return cls(prev_tx, prev_index, script_sig, sequence) |
| 282 | |
| 283 | def serialize(self): |
| 284 | '''Returns the byte serialization of the transaction input''' |
nothing calls this directly
no test coverage detected