def test_address_implementations(test, paramclasses=None, extra_addr_testfunc=lambda *args: False): pub = CPubKey( x('0378d430274f8c5ec1321338151e9f27f4c676a008bdf8638d07c0b6be9ab35c71') ) if paramclasses is None: paramclasses = bitcointx.get_registered_chain_params() for paramclass in paramclasses: with ChainParams(paramclass): def recursive_check(aclass): test.assertTrue(issubclass(aclass, CCoinAddress)) if extra_addr_testfunc(aclass, pub): pass else: a = None if getattr(aclass, 'from_pubkey', None): a = aclass.from_pubkey(pub) elif getattr(aclass, 'from_redeemScript', None): a = aclass.from_redeemScript( CScript(b'\xa9' + Hash160(pub) + b'\x87')) else: assert len(dispatcher_mapped_list(aclass)) > 0,\ ("dispatcher mapped list for {} " "must not be empty".format(aclass)) if a is not None: spk = a.to_scriptPubKey() test.assertEqual(a, aclass.from_scriptPubKey(spk)) a2 = aclass.from_bytes(a) test.assertEqual(bytes(a), bytes(a2)) test.assertEqual(str(a), str(a2)) a3 = aclass(str(a)) test.assertEqual(bytes(a), bytes(a3)) test.assertEqual(str(a), str(a3)) for next_aclass in dispatcher_mapped_list(aclass): recursive_check(next_aclass) recursive_check(CCoinAddress)
def get_params_list(): return [ c for c in get_registered_chain_params() if issubclass(c, ElementsParams) ]
def get_params_list() -> Sequence[Type[ElementsParams]]: return [ c for c in get_registered_chain_params() if issubclass(c, ElementsParams) ]