mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-02-22 22:45:27 +01:00
pytest: check nonstandard onion generation.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
2c9cb8c9e0
commit
d70661d32e
1 changed files with 16 additions and 1 deletions
|
@ -2816,7 +2816,8 @@ def test_partial_payment_htlc_loss(node_factory, bitcoind):
|
|||
def test_createonion_limits(node_factory):
|
||||
l1, = node_factory.get_nodes(1)
|
||||
hops = [{
|
||||
"pubkey": "02eec7245d6b7d2ccb30380bfbe2a3648cd7a942653f5aa340edcea1f283686619",
|
||||
# privkey: 41bfd2660762506c9933ade59f1debf7e6495b10c14a92dbcd2d623da2507d3d
|
||||
"pubkey": "0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c03518",
|
||||
"payload": "00" * 228
|
||||
}, {
|
||||
"pubkey": "0324653eac434488002cc06bbfb7f10fe18991e35f9fe4302dbea6d2353dc0ab1c",
|
||||
|
@ -2840,6 +2841,20 @@ def test_createonion_limits(node_factory):
|
|||
hops[0]['payload'] += '01'
|
||||
l1.rpc.createonion(hops=hops, assocdata="BB" * 32)
|
||||
|
||||
# But with a larger onion, it will work!
|
||||
oniontool = os.path.join(os.path.dirname(__file__), "..", "devtools", "onion")
|
||||
onion = l1.rpc.createonion(hops=hops, assocdata="BB" * 32, onion_size=1301)['onion']
|
||||
|
||||
# Oniontool wants a filename :(
|
||||
onionfile = os.path.join(l1.daemon.lightning_dir, 'onion')
|
||||
with open(onionfile, "w") as f:
|
||||
f.write(onion)
|
||||
|
||||
subprocess.check_output(
|
||||
[oniontool, '--assoc-data', "BB" * 32,
|
||||
'decode', onionfile, "41bfd2660762506c9933ade59f1debf7e6495b10c14a92dbcd2d623da2507d3d"]
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.developer("needs use_shadow")
|
||||
def test_blockheight_disagreement(node_factory, bitcoind, executor):
|
||||
|
|
Loading…
Add table
Reference in a new issue