Takes a byte stream and parses the tx_output at the start return a TxOut object
(cls, s)
| 480 | |
| 481 | @classmethod |
| 482 | def parse(cls, s): |
| 483 | '''Takes a byte stream and parses the tx_output at the start |
| 484 | return a TxOut object |
| 485 | ''' |
| 486 | # amount is an integer in 8 bytes, little endian |
| 487 | amount = little_endian_to_int(s.read(8)) |
| 488 | # use Script.parse to get the ScriptPubKey |
| 489 | script_pubkey = Script.parse(s) |
| 490 | # return an instance of the class (see __init__ for args) |
| 491 | return cls(amount, script_pubkey) |
| 492 | |
| 493 | def serialize(self): |
| 494 | '''Returns the byte serialization of the transaction output''' |
nothing calls this directly
no test coverage detected