Skip to content

Commit

Permalink
feat: Allowing the option to skip the creation of the wallet in bitcoind
Browse files Browse the repository at this point in the history
A few years ago, I added this code for compatibility
with Bitcoin Core 21.

Now that I am integrating it with the LDK node runner, and LDK
can use a wallet to set up a node with Bitcoin Core, we need
a way to disable the wallet from Bitcoin Core to keep
our integration simpler.

Without this change, Bitcoin Core would have two wallets,
and we would need to set up the correct wallet in our architecture.

However, we can simply disable it to avoid this issue.

Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
  • Loading branch information
vincenzopalazzo committed Jul 27, 2023
1 parent 1ecb70c commit 45711de
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
9 changes: 6 additions & 3 deletions lnprototest/backend/bitcoind.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import socket

from contextlib import closing
from typing import Any, Callable
from typing import Any, Callable, Optional
from bitcoin.rpc import RawProxy
from .backend import Backend

Expand Down Expand Up @@ -52,7 +52,8 @@ def f(*args: Any) -> Callable:
class Bitcoind(Backend):
"""Starts regtest bitcoind on an ephemeral port, and returns the RPC proxy"""

def __init__(self, basedir: str):
def __init__(self, basedir: str, with_wallet: Optional[str] = None):
self.with_wallet = with_wallet
self.rpc = None
self.proc = None
self.base_dir = basedir
Expand Down Expand Up @@ -119,7 +120,9 @@ def __version_compatibility(self) -> None:
if self.btc_version >= 210000:
# Maintains the compatibility between wallet
# different ln implementation can use the main wallet (?)
self.rpc.createwallet("main") # Automatically loads
self.rpc.createwallet(
"main" if self.with_wallet is None else self.with_wallet
) # Automatically loads

def __is__bitcoind_ready(self) -> bool:
"""Check if bitcoind is ready during the execution"""
Expand Down
1 change: 0 additions & 1 deletion lnprototest/keyset.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ def __init__(
delayed_payment_base_secret: str,
shachain_seed: str,
):

from .utils import privkey_expand, check_hex

self.revocation_base_secret = privkey_expand(revocation_base_secret)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "lnprototest"
version = "0.0.4"
version = "0.0.5-beta.2"
description = "Spec protocol tests for lightning network implementations"
authors = ["Rusty Russell <rusty@blockstream.com>", "Vincenzo Palazzo <vincenzopalazzodev@gmail.com>"]
license = "MIT"
Expand Down
1 change: 1 addition & 0 deletions tests/test_bolt1-01-init.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
ExpectDisconnect,
)


# BOLT #1: The sending node:
# ...
# - SHOULD NOT set features greater than 13 in `globalfeatures`.
Expand Down

0 comments on commit 45711de

Please sign in to comment.