Takes a byte stream and parses the tx_output at the start return a TxOut object
(cls, s)
| 327 | |
| 328 | @classmethod |
| 329 | def parse(cls, s): |
| 330 | '''Takes a byte stream and parses the tx_output at the start |
| 331 | return a TxOut object |
| 332 | ''' |
| 333 | # amount is an integer in 8 bytes, little endian |
| 334 | amount = little_endian_to_int(s.read(8)) |
| 335 | # use Script.parse to get the ScriptPubKey |
| 336 | script_pubkey = Script.parse(s) |
| 337 | # return an instance of the class (see __init__ for args) |
| 338 | return cls(amount, script_pubkey) |
| 339 | |
| 340 | def serialize(self): |
| 341 | '''Returns the byte serialization of the transaction output''' |
nothing calls this directly
no test coverage detected