(cls, witver, witprog)
| 64 | |
| 65 | @classmethod |
| 66 | def from_bytes(cls, witver, witprog): |
| 67 | |
| 68 | assert witver == 0 |
| 69 | self = super(CBech32BitcoinAddress, cls).from_bytes( |
| 70 | witver, |
| 71 | bytes(witprog) |
| 72 | ) |
| 73 | |
| 74 | if len(self) == 32: |
| 75 | self.__class__ = P2WSHBitcoinAddress |
| 76 | elif len(self) == 20: |
| 77 | self.__class__ = P2WPKHBitcoinAddress |
| 78 | else: |
| 79 | raise CBitcoinAddressError('witness program does not match any known segwit address format') |
| 80 | |
| 81 | return self |
| 82 | |
| 83 | @classmethod |
| 84 | def from_scriptPubKey(cls, scriptPubKey): |
nothing calls this directly
no test coverage detected