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

Function test_bwatch_scriptpubkey_watch

tests/test_plugin.py:5234–5252  ·  view source on GitHub ↗

Test scriptpubkey watch datastore operations

(node_factory, bitcoind)

Source from the content-addressed store, hash-verified

5232
5233
5234def test_bwatch_scriptpubkey_watch(node_factory, bitcoind):
5235 """Test scriptpubkey watch datastore operations"""
5236 l1 = node_factory.get_node(options=BWATCH_OPTS)
5237
5238 # A simple P2PKH scriptpubkey — not used by the wallet (which uses P2WPKH/P2TR/P2SH-P2WPKH)
5239 test_spk = "76a914" + "00" * 20 + "88ac"
5240 expected_key = ['bwatch', 'scriptpubkey', test_spk]
5241
5242 l1.rpc.addscriptpubkeywatch(owner='wallet/p2wpkh/0', scriptpubkey=test_spk, start_block=100)
5243
5244 # Verify our specific key is in the datastore (wallet also has scriptpubkey entries)
5245 ds = l1.rpc.listdatastore(['bwatch', 'scriptpubkey'])
5246 assert any(d['key'] == expected_key for d in ds['datastore'])
5247
5248 # Remove it
5249 l1.rpc.delscriptpubkeywatch(owner='wallet/p2wpkh/0', scriptpubkey=test_spk)
5250
5251 ds = l1.rpc.listdatastore(['bwatch', 'scriptpubkey'])
5252 assert not any(d['key'] == expected_key for d in ds['datastore'])
5253
5254
5255def test_bwatch_outpoint_watch(node_factory, bitcoind):

Callers

nothing calls this directly

Calls 3

listdatastoreMethod · 0.80
anyClass · 0.50
get_nodeMethod · 0.45

Tested by

no test coverage detected