Takes a byte stream and parses the tx_input at the start return a TxIn object
(cls, s)
| 419 | |
| 420 | @classmethod |
| 421 | def parse(cls, s): |
| 422 | '''Takes a byte stream and parses the tx_input at the start |
| 423 | return a TxIn object |
| 424 | ''' |
| 425 | # prev_tx is 32 bytes, little endian |
| 426 | prev_tx = s.read(32)[::-1] |
| 427 | # prev_index is an integer in 4 bytes, little endian |
| 428 | prev_index = little_endian_to_int(s.read(4)) |
| 429 | # use Script.parse to get the ScriptSig |
| 430 | script_sig = Script.parse(s) |
| 431 | # sequence is an integer in 4 bytes, little-endian |
| 432 | sequence = little_endian_to_int(s.read(4)) |
| 433 | # return an instance of the class (see __init__ for args) |
| 434 | return cls(prev_tx, prev_index, script_sig, sequence) |
| 435 | |
| 436 | def serialize(self): |
| 437 | '''Returns the byte serialization of the transaction input''' |
nothing calls this directly
no test coverage detected