b3e868d0af tests/regtest: disable incompatible `validatepegin` for liquidd (Erik Arvstedt)
c30fe1919b netns-isolation: don't auto-assign IPv6 addrs to peer links (Erik Arvstedt)
6584540828 makeShell: make help message extensible (Erik Arvstedt)
0478354477 versioning: move variable (Erik Arvstedt)
8616254d63 bitcoind-rpc-public-whitelist: remove waitfornewblock (Erik Arvstedt)
083e141e3e tests/btcpayserver: test bitcoind P2P connection in regtest (Erik Arvstedt)
82c92df162 tests/regtest: fix restarting bitcoind (Erik Arvstedt)
49086abcc5 liquidd: use systemd startup notification (Erik Arvstedt)
b83fd845c2 update nixpkgs (nixbitcoin)
852c112603 Use HTTPS URL for spark-wallet GitHub node packages (nixbitcoin)

Pull request description:

ACKs for top commit:
  erikarvstedt:
    ACK b3e868d0af
  jonasnick:
    utACK b3e868d0af

Tree-SHA512: 300410157a54f90f40abda064ed9b8f2310e3002bd2eac0527404d5402cd7d87c2d2d1d79d68cf1569841645c333b281d706607deae9461e1ef07f6c20427297
This commit is contained in:
Jonas Nick 2021-11-03 10:25:21 +00:00
commit 3f844c06f0
No known key found for this signature in database
GPG Key ID: 4861DBF262123605
10 changed files with 63 additions and 33 deletions

View File

@ -2,11 +2,11 @@
"nodes": {
"flake-utils": {
"locked": {
"lastModified": 1631561581,
"narHash": "sha256-3VQMV5zvxaVLvqqUrNz3iJelLw30mIVSfZmAaauM3dA=",
"lastModified": 1634851050,
"narHash": "sha256-N83GlSGPJJdcqhUxSCS/WwW5pksYf3VP1M13cDRTSVA=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "7e5bf3925f6fbdfaf50a2a7ca0be2879c4261d19",
"rev": "c91f3de5adaf1de973b797ef7485e441a65b8935",
"type": "github"
},
"original": {
@ -17,11 +17,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1633422542,
"narHash": "sha256-JYz2PmVogNRO8DhcvXzL/QhZzboTspJz2YSRlnAj8aM=",
"lastModified": 1635719588,
"narHash": "sha256-pWjdy0NheM97NsPE6+jUnr5LYyeA0sBGTdw4mfXMGZQ=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "aff647e2704fa1223994604887bb78276dc57083",
"rev": "f0869b1a2c0b150aac26e10bb5c2364ffb2e804f",
"type": "github"
},
"original": {
@ -33,11 +33,11 @@
},
"nixpkgsUnstable": {
"locked": {
"lastModified": 1635295995,
"narHash": "sha256-sGYiXjFlxTTMNb4NSkgvX+knOOTipE6gqwPUQpxNF+c=",
"lastModified": 1635781173,
"narHash": "sha256-nTA2y2jIJiVj5RawHUNhlZUIy5J/Q2CA6YP4T1qBkLo=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "22a500a3f87bbce73bd8d777ef920b43a636f018",
"rev": "7053541084bf5ce2921ef307e5585d39d7ba8b3f",
"type": "github"
},
"original": {

View File

@ -22,7 +22,7 @@ pkgs.stdenv.mkDerivation {
# 2. the shell is interactive
if [[ -t 1 && $- == *i* ]]; then isInteractive=1; else isInteractive=; fi
help() {
nixBitcoinHelp() {
echo "nix-bitcoin path: ${toString ../.}"
echo
echo "Available commands"
@ -46,6 +46,7 @@ pkgs.stdenv.mkDerivation {
echo "update-nix-bitcoin"
echo " Fetch and use the latest version of nix-bitcoin"
}
help() { nixBitcoinHelp; }
h() { help; }
fetch-release() {

View File

@ -25,7 +25,6 @@
"gettxoutsetinfo"
"scantxoutset"
"verifytxoutproof"
"waitfornewblock"
# Mining
"getblocktemplate"
"getmininginfo"

View File

@ -159,10 +159,10 @@ in {
lbtcnodeendpoint=${nbLib.addressWithPort liquidd.address liquidd.whitelistedPort}
''}
'';
in {
in rec {
wantedBy = [ "multi-user.target" ];
requires = [ "bitcoind.service" ];
after = [ "bitcoind.service" ];
requires = [ "bitcoind.service" ] ++ optional cfg.btcpayserver.lbtc "liquidd.service";
after = requires;
preStart = ''
install -m 600 ${configFile} '${cfg.nbxplorer.dataDir}/settings.config'
{

View File

@ -168,6 +168,11 @@ let
bitcoind = config.services.bitcoind;
configFile = pkgs.writeText "elements.conf" ''
# We're already logging via journald
nodebuglogfile=1
startupnotify=/run/current-system/systemd/bin/systemd-notify --ready
chain=${bitcoind.makeNetworkName "liquidv1" ''
regtest
[regtest]'' # Add [regtest] config section
@ -229,6 +234,12 @@ in {
inherit options;
config = mkIf cfg.enable {
assertions = [
{ assertion = bitcoind.regtest -> cfg.validatepegin != true;
message = "liquidd: `validatepegin` is incompatible with regtest.";
}
];
services.bitcoind.enable = true;
environment.systemPackages = [
@ -253,7 +264,8 @@ in {
} >> '${cfg.dataDir}/elements.conf'
'';
serviceConfig = nbLib.defaultHardening // {
Type = "simple";
Type = "notify";
NotifyAccess = "all";
User = cfg.user;
Group = cfg.group;
ExecStart = "${nbPkgs.elementsd}/bin/elementsd -datadir='${cfg.dataDir}'";

View File

@ -173,6 +173,8 @@ in {
${ip} link add ${veth} type veth peer name ${peer}
${ip} link set ${veth} netns ${netnsName}
${ipNetns} addr add ${v.address}/24 dev ${veth}
# The peer link is never used directly, so don't auto-assign an IPv6 address
echo 1 > /proc/sys/net/ipv6/conf/${peer}/disable_ipv6
${ip} link set ${peer} up
${ipNetns} link set ${veth} up
${ip} link set ${peer} master nb-br

View File

@ -22,8 +22,6 @@ let
};
};
version = config.nix-bitcoin.configVersion;
# Sorted by increasing version numbers
changes = [
{
@ -197,6 +195,8 @@ let
'';
};
version = config.nix-bitcoin.configVersion;
incompatibleChanges = optionals
(version != null && versionOlder lastChange)
(builtins.filter (change: versionOlder change && (change.condition or true)) changes);

View File

@ -1399,12 +1399,12 @@ let
sha512 = "dh/frvCBVmSsDYzw6n926jv974gddhkFPfiN8hPOi30Wax25QZyZEGveluCgliBnqmuM+UJmBErbAUFIoDbjOw==";
};
};
"proxy-agent-git://github.com/shesek/node-proxy-agent#0d916427f586e41a1a4485db88509218017f9696" = {
"proxy-agent-https://github.com/shesek/node-proxy-agent#0d916427f586e41a1a4485db88509218017f9696" = {
name = "proxy-agent";
packageName = "proxy-agent";
version = "3.1.1";
src = fetchgit {
url = "git://github.com/shesek/node-proxy-agent";
url = "https://github.com/shesek/node-proxy-agent";
rev = "0d916427f586e41a1a4485db88509218017f9696";
sha256 = "9582aafb90887f3a600806240c0f71fd09ef2b8805a37281894b56e717a35d98";
};
@ -1823,12 +1823,12 @@ let
sha512 = "OUDHEssirmplo3F+1HWKUrUjvnQuA+nZI6i/JJBdXb5eq9IyEQwPyPpqND+SSsxf6TygpBEkUjISVRN4/VOpeg==";
};
};
"superagent-proxy-git://github.com/shesek/superagent-proxy#b512f8bbcf1baa196058922ee3b6cfe45375ebc9" = {
"superagent-proxy-https://github.com/shesek/superagent-proxy#b512f8bbcf1baa196058922ee3b6cfe45375ebc9" = {
name = "superagent-proxy";
packageName = "superagent-proxy";
version = "2.0.0";
src = fetchgit {
url = "git://github.com/shesek/superagent-proxy";
url = "https://github.com/shesek/superagent-proxy";
rev = "b512f8bbcf1baa196058922ee3b6cfe45375ebc9";
sha256 = "ca984f1f2dc7cfed2aa301de1daf4305c359e89276d897fffa92e7c80850d03c";
};
@ -2208,7 +2208,7 @@ in
sources."prelude-ls-1.1.2"
sources."process-nextick-args-2.0.1"
sources."proxy-addr-2.0.6"
(sources."proxy-agent-git://github.com/shesek/node-proxy-agent#0d916427f586e41a1a4485db88509218017f9696" // {
(sources."proxy-agent-https://github.com/shesek/node-proxy-agent#0d916427f586e41a1a4485db88509218017f9696" // {
dependencies = [
sources."debug-4.3.0"
sources."ms-2.1.2"
@ -2273,7 +2273,7 @@ in
sources."semver-7.3.2"
];
})
(sources."superagent-proxy-git://github.com/shesek/superagent-proxy#b512f8bbcf1baa196058922ee3b6cfe45375ebc9" // {
(sources."superagent-proxy-https://github.com/shesek/superagent-proxy#b512f8bbcf1baa196058922ee3b6cfe45375ebc9" // {
dependencies = [
sources."debug-3.2.6"
sources."ms-2.1.2"
@ -2318,4 +2318,4 @@ in
bypassCache = true;
reconstructLock = true;
};
}
}

View File

@ -225,14 +225,16 @@ let
regtestBase = { config, ... }: {
tests.regtest = true;
test.data.num_blocks = 100;
services.bitcoind.regtest = true;
systemd.services.bitcoind.postStart = mkAfter ''
cli=${config.services.bitcoind.cli}/bin/bitcoin-cli
# Don't fail when wallet already exists
$cli createwallet "test" || true
address=$($cli getnewaddress)
$cli generatetoaddress 10 $address
if ! $cli listwallets | ${pkgs.jq}/bin/jq -e 'index("test")'; then
$cli -named createwallet wallet_name=test load_on_startup=true
address=$($cli -rpcwallet=test getnewaddress)
$cli generatetoaddress ${toString config.test.data.num_blocks} $address
fi
'';
# lightning-loop contains no builtin swap server for regtest.
@ -246,6 +248,9 @@ let
services.lightning-pool.extraConfig = ''
auctionserver=localhost
'';
# `validatepegin` is incompatible with regtest
services.liquidd.validatepegin = mkForce false;
};
## Examples / debug helper

View File

@ -189,8 +189,10 @@ def _():
def _():
assert_running("nbxplorer")
machine.wait_until_succeeds(log_has_string("nbxplorer", "BTC: RPC connection successful"))
machine.wait_until_succeeds(log_has_string("nbxplorer", "LBTC: RPC connection successful"))
if "liquidd" in enabled_tests:
machine.wait_until_succeeds(log_has_string("nbxplorer", "LBTC: RPC connection successful"))
wait_for_open_port(ip("nbxplorer"), 24444)
assert_running("btcpayserver")
machine.wait_until_succeeds(log_has_string("btcpayserver", "Listening on"))
wait_for_open_port(ip("btcpayserver"), 23000)
@ -359,6 +361,8 @@ def _():
else:
return False
num_blocks = test_data["num_blocks"]
if enabled("electrs"):
machine.wait_for_unit("onion-addresses")
machine.wait_until_succeeds(log_has_string("electrs", "serving Electrum RPC"))
@ -366,18 +370,18 @@ def _():
"""echo '{"method": "blockchain.headers.subscribe", "id": 0, "params": []}'"""
f" | nc {ip('electrs')} 50001 | head -1 | jq -M .result.height"
)
assert_full_match(get_block_height_cmd, "10\n")
assert_full_match(get_block_height_cmd, f"{num_blocks}\n")
if enabled("clightning"):
machine.wait_until_succeeds(
"[[ $(runuser -u operator -- lightning-cli getinfo | jq -M .blockheight) == 10 ]]"
f"[[ $(runuser -u operator -- lightning-cli getinfo | jq -M .blockheight) == {num_blocks} ]]"
)
if enabled("lnd"):
machine.wait_until_succeeds(
"[[ $(runuser -u operator -- lncli getinfo | jq -M .block_height) == 10 ]]"
f"[[ $(runuser -u operator -- lncli getinfo | jq -M .block_height) == {num_blocks} ]]"
)
if enabled("lightning-loop"):
machine.wait_until_succeeds(
log_has_string("lightning-loop", "Starting event loop at height 10")
log_has_string("lightning-loop", f"Starting event loop at height {num_blocks}")
)
succeed("runuser -u operator -- loop getparams")
if enabled("lightning-pool"):
@ -385,6 +389,13 @@ def _():
log_has_string("lightning-pool", "lnd is now fully synced to its chain backend")
)
succeed("runuser -u operator -- pool orders list")
if enabled("btcpayserver"):
machine.wait_until_succeeds(log_has_string("nbxplorer", f"BTC: Starting scan at block {num_blocks}"))
# nbxplorer 2.2.16 currently fails with with lbtc (liquidd) on regtest
# LBTC: Full node version detected: 210000
# LBTC: RPC connection successful
# LBTC: Failed to connect to RPC
# System.IO.EndOfStreamException: No more byte to read
if "netns-isolation" in enabled_tests:
def ip(name):