From 8a0ceec1ca7dc2777fc3131cd074cfdc60779681 Mon Sep 17 00:00:00 2001 From: Alex Bosworth Date: Sun, 29 Jun 2025 11:33:50 -0700 Subject: [PATCH] pass min reserve argument through to opens --- CHANGELOG.md | 2 +- bos | 2 +- package-lock.json | 4 ++-- package.json | 2 +- peers/channels_from_arguments.js | 3 +++ peers/open_channels.js | 1 + test/peers/test_channels_from_arguments.js | 26 ++++++++++++++++++++++ 7 files changed, 35 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d758d37..00fb558 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Versions -## 19.5.0 +## 19.5.1 - `open`: allow going below safety minimum on remote reserve via `--allow-minimal-reserve` diff --git a/bos b/bos index 43d59df..0e80000 100755 --- a/bos +++ b/bos @@ -1446,7 +1446,7 @@ prog .help('Trusted channel funding is not supported in LND 0.15.0 and below') .help('Simplified Taproot channels are not supported in LND 0.17.0 & below') .argument('', 'With nodes with public keys') - .option('--allow-minimal-reserve', 'Allow peer to have minimal reserve') + .option('--allow-minimal-reserve', 'Allow peers to have minimal reserve') .option('--amount ', 'Capacities to open', REPEATABLE) .option('--avoid-broadcast', 'Avoid broadcasting channel open transaction') .option('--commitment ', 'default or simplified_taproot', REPEATABLE) diff --git a/package-lock.json b/package-lock.json index 875662c..d51ea0f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "balanceofsatoshis", - "version": "19.5.0", + "version": "19.5.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "balanceofsatoshis", - "version": "19.5.0", + "version": "19.5.1", "license": "MIT", "dependencies": { "@alexbosworth/blockchain": "2.0.0", diff --git a/package.json b/package.json index e4509bc..0c6483f 100644 --- a/package.json +++ b/package.json @@ -82,5 +82,5 @@ "postpublish": "docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t alexbosworth/balanceofsatoshis -t alexbosworth/balanceofsatoshis:$npm_package_version --push .", "test": "npx nyc@17.1.0 node --experimental-test-coverage --test test/arrays/*.js test/balances/*.js test/chain/*.js test/display/*.js test/encryption/*.js test/lnd/*.js test/network/*.js test/nodes/*.js test/peers/*.js test/responses/*.js test/routing/*.js test/services/*.js test/swaps/*.js test/tags/*.js test/telegram/*.js test/wallets/*.js" }, - "version": "19.5.0" + "version": "19.5.1" } diff --git a/peers/channels_from_arguments.js b/peers/channels_from_arguments.js index 139fef5..956bf2f 100644 --- a/peers/channels_from_arguments.js +++ b/peers/channels_from_arguments.js @@ -14,6 +14,7 @@ const uniq = arr => Array.from(new Set(arr)); capacities: [] commitments: [] gives: [] + [is_allowing_minimal_reserve]: nodes: [] rates: [] saved: [] @@ -28,6 +29,7 @@ const uniq = arr => Array.from(new Set(arr)); [cooperative_close_address]: description: [give_tokens]: + [is_allowing_minimal_reserve]: is_private: is_simplified_taproot: partner_public_key: @@ -45,6 +47,7 @@ module.exports = args => { description: defaultChannelDescription, fee_rate: numericFeeRate(args.rates[i]), give_tokens: !!args.gives[i] ? Number(args.gives[i]) : undefined, + is_allowing_minimal_reserve: args.is_allowing_minimal_reserve, is_private: !!args.types[i] && privateTypes.includes(args.types[i]), is_simplified_taproot: isSimpleP2tr(args.commitments, i), is_trusted_funding: !!args.types[i] && isTrusted(args.types[i]), diff --git a/peers/open_channels.js b/peers/open_channels.js index 935bb96..3863393 100644 --- a/peers/open_channels.js +++ b/peers/open_channels.js @@ -76,6 +76,7 @@ const utxoPollingTimes = 20; getFile: (path, cbk) => {} } gives: [] + [is_allowing_minimal_reserve]: [is_avoiding_broadcast]: [is_external]: lnd: diff --git a/test/peers/test_channels_from_arguments.js b/test/peers/test_channels_from_arguments.js index dad57ce..a216da5 100644 --- a/test/peers/test_channels_from_arguments.js +++ b/test/peers/test_channels_from_arguments.js @@ -33,6 +33,29 @@ const tests = [ description: 'bos open', fee_rate: undefined, give_tokens: 1, + is_allowing_minimal_reserve: undefined, + is_private: true, + is_simplified_taproot: false, + is_trusted_funding: false, + node: undefined, + partner_public_key: Buffer.alloc(33, 3).toString('hex'), + rate: undefined, + }], + }], + }, + }, + { + args: makeArgs({is_allowing_minimal_reserve: true}), + description: 'Arguments are mapped to channel details with min reserve', + expected: { + opens: [{ + channels: [{ + capacity: 2, + cooperative_close_address: 'address', + description: 'bos open', + fee_rate: undefined, + give_tokens: 1, + is_allowing_minimal_reserve: true, is_private: true, is_simplified_taproot: false, is_trusted_funding: false, @@ -59,6 +82,7 @@ const tests = [ description: 'bos open', fee_rate: undefined, give_tokens: undefined, + is_allowing_minimal_reserve: undefined, is_private: false, is_simplified_taproot: false, is_trusted_funding: false, @@ -89,6 +113,7 @@ const tests = [ description: 'bos open', fee_rate: 1, give_tokens: 3, + is_allowing_minimal_reserve: undefined, is_private: true, is_simplified_taproot: false, is_trusted_funding: false, @@ -105,6 +130,7 @@ const tests = [ description: 'bos open', fee_rate: 2, give_tokens: 4, + is_allowing_minimal_reserve: undefined, is_private: false, is_simplified_taproot: false, is_trusted_funding: false,