mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-24 01:24:26 +01:00
coin_mvt: log events for pushes/lease_fees for leased channels
We need to stash/save the amount of the lease fees on a leased channel, we do this by re-using the 'push' amount field on channel (which is technically correct, since we're essentially pushing the fee amount to the peer). Also updates a bit of how the pushes are accounted for (pushed to now has an event; their channel will open at zero but then they'll immediately register a push event). Leases fees are treated exactly the same as pushes, except labeled differently. Required adding a 'lease_fee' field to the inflights so we keep track of the fee for the lease until the open happens.
This commit is contained in:
@@ -1074,7 +1074,7 @@ def test_funding_push(node_factory, bitcoind, chainparams):
|
||||
coin_mvt_plugin = os.path.join(os.getcwd(), 'tests/plugins/coin_movements.py')
|
||||
|
||||
l1 = node_factory.get_node(options={'plugin': coin_mvt_plugin})
|
||||
l2 = node_factory.get_node()
|
||||
l2 = node_factory.get_node(options={'plugin': coin_mvt_plugin})
|
||||
|
||||
l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
|
||||
|
||||
@@ -1103,11 +1103,17 @@ def test_funding_push(node_factory, bitcoind, chainparams):
|
||||
chanid = first_channel_id(l2, l1)
|
||||
# give the file write a second
|
||||
time.sleep(1)
|
||||
channel_mvts = [
|
||||
channel_mvts_1 = [
|
||||
{'type': 'chain_mvt', 'credit': 16777215000, 'debit': 0, 'tags': ['channel_open', 'opener']},
|
||||
{'type': 'channel_mvt', 'credit': 0, 'debit': 20000000, 'tags': ['pushed']},
|
||||
{'type': 'channel_mvt', 'credit': 0, 'debit': 20000000, 'tags': ['pushed'], 'fees': '0msat'},
|
||||
]
|
||||
check_coin_moves(l1, chanid, channel_mvts, chainparams)
|
||||
channel_mvts_2 = [
|
||||
{'type': 'chain_mvt', 'credit': 0, 'debit': 0, 'tags': ['channel_open']},
|
||||
{'type': 'channel_mvt', 'credit': 20000000, 'debit': 0, 'tags': ['pushed'], 'fees': '0msat'},
|
||||
]
|
||||
check_coin_moves(l1, chanid, channel_mvts_1, chainparams)
|
||||
check_coin_moves(l2, chanid, channel_mvts_2, chainparams)
|
||||
|
||||
assert account_balance(l1, chanid) == (amount - push_sat) * 1000
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user