-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add test for wallet remove * Delete smaug db when removing wallet (WIP) * Remove the wallet db file only * Refactor constructing db_path to get_db_path * Refactor constructing db_path to get_db_path /2 * Rename get_db_path -> get_db_file_path * Do not expose db_path, instead retrieve from inside test code
- Loading branch information
Showing
4 changed files
with
62 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
from pprint import pprint | ||
|
||
from conftest import SMAUG_PLUGIN | ||
from fixtures import * | ||
from pyln.client import Millisatoshi | ||
from pyln.testing.utils import BITCOIND_CONFIG, only_one, wait_for | ||
from utils import * | ||
import os | ||
def test_rpc_remove(node_factory, bitcoind): | ||
""" | ||
Test RPC remove. | ||
""" | ||
|
||
l1 = node_factory.get_nodes( | ||
1, | ||
opts={ | ||
"allow_broken_log": True, | ||
"plugin": SMAUG_PLUGIN, | ||
"smaug_brpc_user": BITCOIND_CONFIG["rpcuser"], | ||
"smaug_brpc_pass": BITCOIND_CONFIG["rpcpassword"], | ||
"smaug_brpc_port": BITCOIND_CONFIG["rpcport"], | ||
}, | ||
)[0] | ||
|
||
# get external/internal only_one descriptors | ||
internal_descriptor = get_only_one_descriptor(bitcoind, "wpkh", True) | ||
external_descriptor = get_only_one_descriptor(bitcoind, "wpkh", False) | ||
|
||
# add wallet to smaug | ||
wallet = l1.rpc.smaug("add", external_descriptor, internal_descriptor) | ||
wallet_name = wallet["name"] | ||
db_file_path = f"{str(l1.lightning_dir)}/regtest/.smaug/{wallet_name}.db" | ||
smaug_wallets = l1.rpc.smaug("ls") | ||
assert len(smaug_wallets) == 1 | ||
assert wallet_name in smaug_wallets | ||
assert os.path.isfile(db_file_path) | ||
|
||
# remove wallet from smaug | ||
result = l1.rpc.smaug("remove", wallet_name) | ||
|
||
smaug_wallets = l1.rpc.smaug("ls") | ||
assert len(smaug_wallets) == 0 | ||
assert result == f"Deleted wallet: {wallet_name}" | ||
assert not os.path.isfile(db_file_path) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters