def address_handlers(self): return ScriptPubKey.PayToHandlers( address=self.P2PKH_address_from_hash160, script_hash=self.P2SH_address_from_hash160, pubkey=self.P2PKH_address_from_pubkey, unspendable=lambda: None, strange=self.claim_address_handler, )
def address_from_script(cls, script): '''Given a pk_script, return the adddress it pays to, or None.''' return ScriptPubKey.pay_to(cls.address_handlers, script)