mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 05:12:45 +01:00
liquid-compat: update coinmove check to be liquid compatible
🎉 :waterfall:
This commit is contained in:
parent
ba6e4b6ef2
commit
8185474bfb
@ -821,8 +821,7 @@ def test_funding_toolarge(node_factory, bitcoind):
|
|||||||
l1.rpc.fundchannel(l2.info['id'], amount)
|
l1.rpc.fundchannel(l2.info['id'], amount)
|
||||||
|
|
||||||
|
|
||||||
@unittest.skipIf(TEST_NETWORK != 'regtest', "check_coin_moves is network-specific")
|
def test_funding_push(node_factory, bitcoind, chainparams):
|
||||||
def test_funding_push(node_factory, bitcoind):
|
|
||||||
""" Try to push peer some sats """
|
""" Try to push peer some sats """
|
||||||
# We track balances, to verify that accounting is ok.
|
# We track balances, to verify that accounting is ok.
|
||||||
coin_mvt_plugin = os.path.join(os.getcwd(), 'tests/plugins/coin_movements.py')
|
coin_mvt_plugin = os.path.join(os.getcwd(), 'tests/plugins/coin_movements.py')
|
||||||
@ -862,7 +861,7 @@ def test_funding_push(node_factory, bitcoind):
|
|||||||
{'type': 'chain_mvt', 'credit': 0, 'debit': 20000000, 'tag': 'pushed'},
|
{'type': 'chain_mvt', 'credit': 0, 'debit': 20000000, 'tag': 'pushed'},
|
||||||
{'type': 'chain_mvt', 'credit': 16777215000, 'debit': 0, 'tag': 'deposit'},
|
{'type': 'chain_mvt', 'credit': 16777215000, 'debit': 0, 'tag': 'deposit'},
|
||||||
]
|
]
|
||||||
check_coin_moves(l1, chanid, channel_mvts)
|
check_coin_moves(l1, chanid, channel_mvts, chainparams)
|
||||||
assert account_balance(l1, chanid) == (amount - push_sat) * 1000
|
assert account_balance(l1, chanid) == (amount - push_sat) * 1000
|
||||||
|
|
||||||
|
|
||||||
|
@ -658,7 +658,7 @@ def test_withdraw_misc(node_factory, bitcoind, chainparams):
|
|||||||
{'type': 'chain_mvt', 'credit': 0, 'debit': 11957378000, 'tag': 'withdrawal'},
|
{'type': 'chain_mvt', 'credit': 0, 'debit': 11957378000, 'tag': 'withdrawal'},
|
||||||
{'type': 'chain_mvt', 'credit': 0, 'debit': 3652000, 'tag': 'chain_fees'},
|
{'type': 'chain_mvt', 'credit': 0, 'debit': 3652000, 'tag': 'chain_fees'},
|
||||||
]
|
]
|
||||||
check_coin_moves(l1, 'wallet', wallet_moves)
|
check_coin_moves(l1, 'wallet', wallet_moves, chainparams)
|
||||||
|
|
||||||
|
|
||||||
def test_minconf_withdraw(node_factory, bitcoind):
|
def test_minconf_withdraw(node_factory, bitcoind):
|
||||||
|
@ -1360,7 +1360,7 @@ def test_plugin_fail(node_factory):
|
|||||||
|
|
||||||
|
|
||||||
@unittest.skipIf(not DEVELOPER, "without DEVELOPER=1, gossip v slow")
|
@unittest.skipIf(not DEVELOPER, "without DEVELOPER=1, gossip v slow")
|
||||||
def test_coin_movement_notices(node_factory, bitcoind):
|
def test_coin_movement_notices(node_factory, bitcoind, chainparams):
|
||||||
"""Verify that coin movements are triggered correctly.
|
"""Verify that coin movements are triggered correctly.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@ -1373,6 +1373,26 @@ def test_coin_movement_notices(node_factory, bitcoind):
|
|||||||
{'type': 'chain_mvt', 'credit': 0, 'debit': 1, 'tag': 'chain_fees'},
|
{'type': 'chain_mvt', 'credit': 0, 'debit': 1, 'tag': 'chain_fees'},
|
||||||
{'type': 'chain_mvt', 'credit': 0, 'debit': 100001000, 'tag': 'withdrawal'},
|
{'type': 'chain_mvt', 'credit': 0, 'debit': 100001000, 'tag': 'withdrawal'},
|
||||||
]
|
]
|
||||||
|
if chainparams['elements']:
|
||||||
|
l2_l3_mvts = [
|
||||||
|
{'type': 'chain_mvt', 'credit': 1000000000, 'debit': 0, 'tag': 'deposit'},
|
||||||
|
{'type': 'channel_mvt', 'credit': 0, 'debit': 100000000, 'tag': 'routed'},
|
||||||
|
{'type': 'channel_mvt', 'credit': 50000501, 'debit': 0, 'tag': 'routed'},
|
||||||
|
{'type': 'chain_mvt', 'credit': 0, 'debit': 8955501, 'tag': 'chain_fees'},
|
||||||
|
{'type': 'chain_mvt', 'credit': 0, 'debit': 941045000, 'tag': 'withdrawal'},
|
||||||
|
]
|
||||||
|
|
||||||
|
l2_wallet_mvts = [
|
||||||
|
{'type': 'chain_mvt', 'credit': 2000000000, 'debit': 0, 'tag': 'deposit'},
|
||||||
|
{'type': 'chain_mvt', 'credit': 0, 'debit': 0, 'tag': 'spend_track'},
|
||||||
|
{'type': 'chain_mvt', 'credit': 0, 'debit': 991893000, 'tag': 'withdrawal'},
|
||||||
|
{'type': 'chain_mvt', 'credit': 0, 'debit': 1000000000, 'tag': 'withdrawal'},
|
||||||
|
{'type': 'chain_mvt', 'credit': 0, 'debit': 8107000, 'tag': 'chain_fees'},
|
||||||
|
{'type': 'chain_mvt', 'credit': 991893000, 'debit': 0, 'tag': 'deposit'},
|
||||||
|
{'type': 'chain_mvt', 'credit': 100001000, 'debit': 0, 'tag': 'deposit'},
|
||||||
|
{'type': 'chain_mvt', 'credit': 941045000, 'debit': 0, 'tag': 'deposit'},
|
||||||
|
]
|
||||||
|
else:
|
||||||
l2_l3_mvts = [
|
l2_l3_mvts = [
|
||||||
{'type': 'chain_mvt', 'credit': 1000000000, 'debit': 0, 'tag': 'deposit'},
|
{'type': 'chain_mvt', 'credit': 1000000000, 'debit': 0, 'tag': 'deposit'},
|
||||||
{'type': 'channel_mvt', 'credit': 0, 'debit': 100000000, 'tag': 'routed'},
|
{'type': 'channel_mvt', 'credit': 0, 'debit': 100000000, 'tag': 'routed'},
|
||||||
@ -1380,6 +1400,7 @@ def test_coin_movement_notices(node_factory, bitcoind):
|
|||||||
{'type': 'chain_mvt', 'credit': 0, 'debit': 5430501, 'tag': 'chain_fees'},
|
{'type': 'chain_mvt', 'credit': 0, 'debit': 5430501, 'tag': 'chain_fees'},
|
||||||
{'type': 'chain_mvt', 'credit': 0, 'debit': 944570000, 'tag': 'withdrawal'},
|
{'type': 'chain_mvt', 'credit': 0, 'debit': 944570000, 'tag': 'withdrawal'},
|
||||||
]
|
]
|
||||||
|
|
||||||
l2_wallet_mvts = [
|
l2_wallet_mvts = [
|
||||||
{'type': 'chain_mvt', 'credit': 2000000000, 'debit': 0, 'tag': 'deposit'},
|
{'type': 'chain_mvt', 'credit': 2000000000, 'debit': 0, 'tag': 'deposit'},
|
||||||
{'type': 'chain_mvt', 'credit': 0, 'debit': 0, 'tag': 'spend_track'},
|
{'type': 'chain_mvt', 'credit': 0, 'debit': 0, 'tag': 'spend_track'},
|
||||||
@ -1468,7 +1489,7 @@ def test_coin_movement_notices(node_factory, bitcoind):
|
|||||||
assert account_balance(l2, chanid_3) == 0
|
assert account_balance(l2, chanid_3) == 0
|
||||||
|
|
||||||
# Verify we recorded all the movements we expect
|
# Verify we recorded all the movements we expect
|
||||||
check_coin_moves(l2, chanid_1, l1_l2_mvts)
|
check_coin_moves(l2, chanid_1, l1_l2_mvts, chainparams)
|
||||||
check_coin_moves(l2, chanid_3, l2_l3_mvts)
|
check_coin_moves(l2, chanid_3, l2_l3_mvts, chainparams)
|
||||||
check_coin_moves(l2, 'wallet', l2_wallet_mvts)
|
check_coin_moves(l2, 'wallet', l2_wallet_mvts, chainparams)
|
||||||
check_coin_moves_idx(l2)
|
check_coin_moves_idx(l2)
|
||||||
|
@ -712,7 +712,7 @@ def test_sign_and_send_psbt(node_factory, bitcoind, chainparams):
|
|||||||
{'type': 'chain_mvt', 'credit': 0, 'debit': 0, 'tag': 'chain_fees'},
|
{'type': 'chain_mvt', 'credit': 0, 'debit': 0, 'tag': 'chain_fees'},
|
||||||
{'type': 'chain_mvt', 'credit': 988255000, 'debit': 0, 'tag': 'deposit'},
|
{'type': 'chain_mvt', 'credit': 988255000, 'debit': 0, 'tag': 'deposit'},
|
||||||
]
|
]
|
||||||
check_coin_moves(l1, 'wallet', wallet_coin_mvts)
|
check_coin_moves(l1, 'wallet', wallet_coin_mvts, chainparams)
|
||||||
|
|
||||||
|
|
||||||
def test_txsend(node_factory, bitcoind, chainparams):
|
def test_txsend(node_factory, bitcoind, chainparams):
|
||||||
|
@ -49,7 +49,7 @@ def expected_channel_features(wumbo_channels=False, extra=[]):
|
|||||||
return hex_bits(features + extra)
|
return hex_bits(features + extra)
|
||||||
|
|
||||||
|
|
||||||
def check_coin_moves(n, account_id, expected_moves):
|
def check_coin_moves(n, account_id, expected_moves, chainparams):
|
||||||
moves = n.rpc.call('listcoinmoves_plugin')['coin_moves']
|
moves = n.rpc.call('listcoinmoves_plugin')['coin_moves']
|
||||||
node_id = n.info['id']
|
node_id = n.info['id']
|
||||||
acct_moves = [m for m in moves if m['account_id'] == account_id]
|
acct_moves = [m for m in moves if m['account_id'] == account_id]
|
||||||
@ -62,7 +62,7 @@ def check_coin_moves(n, account_id, expected_moves):
|
|||||||
assert mv['debit'] == "{}msat".format(exp['debit'])
|
assert mv['debit'] == "{}msat".format(exp['debit'])
|
||||||
assert mv['tag'] == exp['tag']
|
assert mv['tag'] == exp['tag']
|
||||||
assert mv['timestamp'] > 0
|
assert mv['timestamp'] > 0
|
||||||
assert mv['coin_type'] == 'bcrt'
|
assert mv['coin_type'] == chainparams['bip173_prefix']
|
||||||
# chain moves should have blockheights
|
# chain moves should have blockheights
|
||||||
if mv['type'] == 'chain_mvt':
|
if mv['type'] == 'chain_mvt':
|
||||||
assert mv['blockheight'] is not None
|
assert mv['blockheight'] is not None
|
||||||
|
Loading…
Reference in New Issue
Block a user