(cls, s, testnet=False)
| 106 | # tag::source2[] |
| 107 | @classmethod |
| 108 | def parse(cls, s, testnet=False): |
| 109 | s.read(4) # <1> |
| 110 | if s.read(1) == b'\x00': # <2> |
| 111 | parse_method = cls.parse_segwit |
| 112 | else: |
| 113 | parse_method = cls.parse_legacy |
| 114 | s.seek(-5, 1) # <3> |
| 115 | return parse_method(s, testnet=testnet) |
| 116 | |
| 117 | @classmethod |
| 118 | def parse_legacy(cls, s, testnet=False): |