Convert a scriptPubKey to a P2WPKH address Raises CBitcoinAddressError if the scriptPubKey isn't of the correct form.
(cls, scriptPubKey)
| 305 | |
| 306 | @classmethod |
| 307 | def from_scriptPubKey(cls, scriptPubKey): |
| 308 | """Convert a scriptPubKey to a P2WPKH address |
| 309 | |
| 310 | Raises CBitcoinAddressError if the scriptPubKey isn't of the correct |
| 311 | form. |
| 312 | """ |
| 313 | if scriptPubKey.is_witness_v0_keyhash(): |
| 314 | return cls.from_bytes(0, scriptPubKey[2:22]) |
| 315 | else: |
| 316 | raise CBitcoinAddressError('not a P2WPKH scriptPubKey') |
| 317 | |
| 318 | def to_scriptPubKey(self): |
| 319 | """Convert an address to a scriptPubKey""" |
nothing calls this directly
no test coverage detected