Convert a scriptPubKey to a CBitcoinAddress Returns a CBitcoinAddress subclass, either P2SHBitcoinAddress or P2PKHBitcoinAddress. If the scriptPubKey is not recognized CBitcoinAddressError will be raised.
(cls, scriptPubKey)
| 121 | |
| 122 | @classmethod |
| 123 | def from_scriptPubKey(cls, scriptPubKey): |
| 124 | """Convert a scriptPubKey to a CBitcoinAddress |
| 125 | |
| 126 | Returns a CBitcoinAddress subclass, either P2SHBitcoinAddress or |
| 127 | P2PKHBitcoinAddress. If the scriptPubKey is not recognized |
| 128 | CBitcoinAddressError will be raised. |
| 129 | """ |
| 130 | try: |
| 131 | return P2SHBitcoinAddress.from_scriptPubKey(scriptPubKey) |
| 132 | except CBitcoinAddressError: |
| 133 | pass |
| 134 | |
| 135 | try: |
| 136 | return P2PKHBitcoinAddress.from_scriptPubKey(scriptPubKey) |
| 137 | except CBitcoinAddressError: |
| 138 | pass |
| 139 | |
| 140 | raise CBitcoinAddressError('scriptPubKey not a valid base58-encoded address') |
| 141 | |
| 142 | |
| 143 | class P2SHBitcoinAddress(CBase58BitcoinAddress): |
nothing calls this directly
no test coverage detected