mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 07:04:22 +01:00
coin_mvts: rewrite how onchain events are recorded, update tests
The old model of coin movements attempted to compute fees etc and log amounts, not utxos. This is not as robust, as multi-party opens and dual funded channels make it hard to account for fees etc correctly. Instead, we move towards a 'utxo' view of the onchain events. Every event is either the creation or 'destruction' of a utxo. For cases where the value of the utxo is not (fully) debited/credited to our account, we also record the output_value. E.g. channel closings spend a utxo who's entire value we may not own. Since we're now tracking UTXOs onchain, we can now do more complex assertions about the onchain footprint of them. The integration tests have been updated to now use more 'chain aware' assertions about the ending state.
This commit is contained in:
@@ -1101,12 +1101,11 @@ def test_funding_push(node_factory, bitcoind, chainparams):
|
||||
assert funds['channel_sat'] + push_sat == funds['channel_total_sat']
|
||||
|
||||
chanid = first_channel_id(l2, l1)
|
||||
l1.daemon.wait_for_log('coins account: {}'.format(chanid))
|
||||
# give the file write a second
|
||||
time.sleep(1)
|
||||
channel_mvts = [
|
||||
{'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': 'channel_open'},
|
||||
{'type': 'channel_mvt', 'credit': 0, 'debit': 20000000, 'tag': 'pushed'},
|
||||
]
|
||||
check_coin_moves(l1, chanid, channel_mvts, chainparams)
|
||||
assert account_balance(l1, chanid) == (amount - push_sat) * 1000
|
||||
|
||||
Reference in New Issue
Block a user