mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-20 07:34:24 +01:00
bitcoin: add weight calculation helpers.
These are pulled from wallet/wallet.c, with the fix now that we grind sigs. This reduces the fees we pay slightly, as you can see in the coinmoves changes. I now print out all the coin moves in suitable format before we match: you only see this if the test fails, but it's really helpful. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
committed by
Christian Decker
parent
1ef0ca51b0
commit
7aa8ffa2a0
@@ -1,6 +1,7 @@
|
||||
from pyln.testing.utils import TEST_NETWORK, SLOW_MACHINE, TIMEOUT, VALGRIND, DEVELOPER, DEPRECATED_APIS # noqa: F401
|
||||
from pyln.testing.utils import env, only_one, wait_for, write_config, TailableProc, sync_blockheight, wait_channel_quiescent, get_tx_p2wsh_outnum # noqa: F401
|
||||
import bitstring
|
||||
from pyln.client import Millisatoshi
|
||||
|
||||
EXPERIMENTAL_FEATURES = env("EXPERIMENTAL_FEATURES", "0") == "1"
|
||||
COMPAT = env("COMPAT", "1") == "1"
|
||||
@@ -53,6 +54,13 @@ def check_coin_moves(n, account_id, expected_moves, chainparams):
|
||||
moves = n.rpc.call('listcoinmoves_plugin')['coin_moves']
|
||||
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': {}, 'tag': '{}'}},"
|
||||
.format(mv['type'],
|
||||
Millisatoshi(mv['credit']).millisatoshis,
|
||||
Millisatoshi(mv['debit']).millisatoshis,
|
||||
mv['tag']))
|
||||
|
||||
assert len(acct_moves) == len(expected_moves)
|
||||
for mv, exp in list(zip(acct_moves, expected_moves)):
|
||||
assert mv['version'] == 1
|
||||
|
||||
Reference in New Issue
Block a user