coin_mvt: record new 'fees' field on htlc channel moves

We record the amount of fees collected for a routed payment. For
simplicity's sake on the data agg side, we record the fee payment on
*BOTH* the incoming htlc and the outgoing htlc. Note that this results
in double counting if you add up the fees from both an in-routed and
out-routed payment.
This commit is contained in:
niftynei
2021-12-07 10:05:29 -06:00
committed by Rusty Russell
parent b6463174d6
commit 29c6718297
9 changed files with 105 additions and 38 deletions

View File

@@ -79,6 +79,13 @@ def move_matches(exp, mv):
return False
if mv['tags'] != exp['tags']:
return False
if 'fees' in exp:
if 'fees' not in mv:
return False
if mv['fees'] != exp['fees']:
return False
elif 'fees' in mv:
return False
return True
@@ -94,11 +101,12 @@ def check_coin_moves(n, account_id, expected_moves, chainparams):
node_id = n.info['id']
acct_moves = [m for m in moves if m['account_id'] == account_id]
for mv in acct_moves:
print("{{'type': '{}', 'credit': {}, 'debit': {}, 'tags': '{}'}},"
print("{{'type': '{}', 'credit': {}, 'debit': {}, 'tags': '{}' , ['fees'?: '{}']}},"
.format(mv['type'],
Millisatoshi(mv['credit']).millisatoshis,
Millisatoshi(mv['debit']).millisatoshis,
mv['tags']))
mv['tags'],
mv['fees'] if 'fees' in mv else ''))
assert mv['version'] == 2
assert mv['node_id'] == node_id
assert mv['timestamp'] > 0