elements: Parametrize the sample addresses we test against

Since elements addresses look quite different from the bitcoin mainnet
addresses I just added a sample to the chainparams fixture. In addition I
extracted some of the fixed strings to reference chainparams instead.

Signed-off-by: Christian Decker <decker.christian@gmail.com>
This commit is contained in:
Christian Decker
2019-06-29 18:54:39 +02:00
committed by Rusty Russell
parent 9e333f2416
commit 8a69ea7bf5
4 changed files with 52 additions and 45 deletions

View File

@@ -1512,12 +1512,12 @@ def test_newaddr(node_factory, chainparams):
assert both['bech32'].startswith(chainparams['bip173_prefix'])
def test_newaddr_deprecated(node_factory):
def test_newaddr_deprecated(node_factory, chainparams):
l1 = node_factory.get_node(options={'allow-deprecated-apis': True})
p2sh = l1.rpc.newaddr('p2sh-segwit')
assert p2sh['address'].startswith('2')
assert p2sh['address'].startswith(chainparams['p2sh_prefix'])
bech32 = l1.rpc.newaddr('bech32')
assert bech32['address'].startswith('bcrt1')
assert bech32['address'].startswith(chainparams['bip173_prefix'])
def test_bitcoind_fail_first(node_factory, bitcoind, executor):