MCPcopy Create free account
hub / github.com/ElementsProject/lightning / test_payerkey

Function test_payerkey

tests/test_pay.py:5470–5505  ·  view source on GitHub ↗

payerkey calculation should not change across releases!

(node_factory, old_hsmsecret)

Source from the content-addressed store, hash-verified

5468@pytest.mark.parametrize("old_hsmsecret", [True, False])
5469@pytest.mark.slow_test
5470def test_payerkey(node_factory, old_hsmsecret):
5471 """payerkey calculation should not change across releases!"""
5472 nodes = node_factory.get_nodes(7, opts={'old_hsmsecret': old_hsmsecret})
5473
5474 if old_hsmsecret:
5475 expected_keys = ["035e43e4ec029ee6cc0e320ebefdf863bc0f284ec0208275f780837d17e21bba32",
5476 "02411811b24f4940de49ad460ee14ecb96810e29ca49cdd3600a985da2eda06b87",
5477 "036a19f00424ff244af1841715e89f3716c08f1f62a8e5d9bd0f69a21aa96a7b8d",
5478 "026d8b82fe6039fe16f8ef376174b630247e821331b90620315a1e9c3db8384056",
5479 "0393fb950e04916c063a585aa644df3d72642c16de4eb44ccf5dbede194836140f",
5480 "030b68257230f7057e694222bbd54d9d108decced6b647a90da6f578360af53f7d",
5481 "02f402bd7374a1304b07c7236d9c683b83f81072517195ddede8ab328026d53157"]
5482 else:
5483 expected_keys = ["027c4ec2cf63aeb101109d6d16b9a97e74cd9a149860c16a9fd6ddddf18d337193",
5484 "028cd5b653ba55558095e66c0c42c43dd1077598a8d08a097387383dece4c2a325",
5485 "02bf5fe9675aed4728c7ed6afb3dab02143cbb693d2c49f62d4c28704d9877fbd0",
5486 "037b07ee0335a92f47e803d6ce5500dca721b43a1a9bc4a6ea6b75db4508c7b7de",
5487 "02484674b6acc7f3ddb4c5b13ef14ab0b018e748f4f3bffc55ab36dc57fdff6ec5",
5488 "024d11164cfd85c0f9383dd78703d3ad533e5af57bc5a09c1c1dae595f212941ae",
5489 "0369fb4a73973a31f7d357f4ec39fcc5663f9abae8b5fd47d1a3ada04ee4ae5656"]
5490
5491 bolt12tool = os.path.join(os.path.dirname(__file__), "..", "devtools", "bolt12-cli")
5492
5493 # Returns "lnr <hexstring>" on first line
5494 hexprefix = subprocess.check_output([bolt12tool, 'decodehex',
5495 'lnr1qqgz2d7u2smys9dc5q2447e8thjlgq3qqc3xu3s3rg94nj40zfsy866mhu5vxne6tcej5878k2mneuvgjy8ssqvepgz5zsjrg3z3vggzvkm2khkgvrxj27r96c00pwl4kveecdktm29jdd6w0uwu5jgtv5v9qgqxyfhyvyg6pdvu4tcjvpp7kkal9rp57wj7xv4pl3ajku70rzy3pu']).decode('UTF-8').split('\n')[0].split()
5496
5497 # Now we are supposed to put invreq_payer_id inside invreq, and lightningd
5498 # checks the derivation as a courtesy. Fortunately, invreq_payer_id is last
5499 for n, k in zip(nodes, expected_keys):
5500 # BOLT #12:
5501 # 1. type: 88 (`invreq_payer_id`)
5502 # 2. data:
5503 # * [`point`:`key`]
5504 encoded = subprocess.check_output([bolt12tool, 'encodehex'] + hexprefix + ['5821', k]).decode('UTF-8').strip()
5505 n.rpc.createinvoicerequest(encoded, False)['bolt12']
5506
5507
5508def test_pay_multichannel_use_zeroconf(bitcoind, node_factory):

Callers

nothing calls this directly

Calls 3

get_nodesMethod · 0.80
joinMethod · 0.80
decodeMethod · 0.45

Tested by

no test coverage detected