Skip to content

Commit d5138c1

Browse files
authored
Merge pull request #8505 from yyforyongyu/version-check-testmempool
lnwallet: skip `testmempoolaccept` when the backend version is too low
2 parents 56f17af + c9f857e commit d5138c1

File tree

4 files changed

+23
-7
lines changed

4 files changed

+23
-7
lines changed

docs/release-notes/release-notes-0.18.0.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,10 @@
136136
through [mempool acceptance
137137
check](https://github.com/lightningnetwork/lnd/pull/8345) before being
138138
broadcast. This means when a transaction has failed the `testmempoolaccept`
139-
check by bitcoind or btcd, the broadcast won't be attempted.
139+
check by bitcoind or btcd, the broadcast won't be attempted. This check will
140+
be performed if the version of the chain backend supports it - for bitcoind
141+
it's v22.0.0 and above, for btcd it's v0.24.1 and above. Otherwise, the check
142+
will be [skipped](https://github.com/lightningnetwork/lnd/pull/8505)
140143

141144
* The `coin-selection-strategy` config option [now also applies to channel
142145
funding operations and the new `PsbtCoinSelect` option of the `FundPsbt`

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ require (
44
github.com/NebulousLabs/go-upnp v0.0.0-20180202185039-29b680b06c82
55
github.com/Yawning/aez v0.0.0-20211027044916-e49e68abd344
66
github.com/andybalholm/brotli v1.0.3
7-
github.com/btcsuite/btcd v0.24.1-0.20240123000108-62e6af035ec5
7+
github.com/btcsuite/btcd v0.24.1-0.20240301210420-1a2b599bf1af
88
github.com/btcsuite/btcd/btcec/v2 v2.3.2
99
github.com/btcsuite/btcd/btcutil v1.1.5
1010
github.com/btcsuite/btcd/btcutil/psbt v1.1.8
1111
github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0
1212
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f
13-
github.com/btcsuite/btcwallet v0.16.10-0.20240206195028-1f3534b00d14
13+
github.com/btcsuite/btcwallet v0.16.10-0.20240305014015-f7c216e78ee8
1414
github.com/btcsuite/btcwallet/wallet/txauthor v1.3.4
1515
github.com/btcsuite/btcwallet/wallet/txrules v1.2.1
1616
github.com/btcsuite/btcwallet/walletdb v1.4.1

go.sum

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6r
7171
github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ=
7272
github.com/btcsuite/btcd v0.22.0-beta.0.20220111032746-97732e52810c/go.mod h1:tjmYdS6MLJ5/s0Fj4DbLgSbDHbEqLJrtnHecBFkdz5M=
7373
github.com/btcsuite/btcd v0.23.5-0.20231215221805-96c9fd8078fd/go.mod h1:nm3Bko6zh6bWP60UxwoT5LzdGJsQJaPo6HjduXq9p6A=
74-
github.com/btcsuite/btcd v0.24.1-0.20240123000108-62e6af035ec5 h1:8BHBWvtP6kkzvmCpyWEznq4eS0gfLOSVuXLesv413Xs=
75-
github.com/btcsuite/btcd v0.24.1-0.20240123000108-62e6af035ec5/go.mod h1:5C8ChTkl5ejr3WHj8tkQSCmydiMEPB0ZhQhehpq7Dgg=
74+
github.com/btcsuite/btcd v0.24.1-0.20240301210420-1a2b599bf1af h1:F60A3wst4/fy9Yr1Vn8MYmFlfn7DNLxp8o8UTvhqgBE=
75+
github.com/btcsuite/btcd v0.24.1-0.20240301210420-1a2b599bf1af/go.mod h1:5C8ChTkl5ejr3WHj8tkQSCmydiMEPB0ZhQhehpq7Dgg=
7676
github.com/btcsuite/btcd/btcec/v2 v2.1.0/go.mod h1:2VzYrv4Gm4apmbVVsSq5bqf1Ec8v56E48Vt0Y/umPgA=
7777
github.com/btcsuite/btcd/btcec/v2 v2.1.3/go.mod h1:ctjw4H1kknNJmRN4iP1R7bTQ+v3GJkZBd6mui8ZsAZE=
7878
github.com/btcsuite/btcd/btcec/v2 v2.3.2 h1:5n0X6hX0Zk+6omWcihdYvdAlGf2DfasC0GMf7DClJ3U=
@@ -90,8 +90,8 @@ github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0/go.mod h1:7SFka0XMvUgj3hfZtyd
9090
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f h1:bAs4lUbRJpnnkd9VhRV3jjAVU7DJVjMaK+IsvSeZvFo=
9191
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA=
9292
github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg=
93-
github.com/btcsuite/btcwallet v0.16.10-0.20240206195028-1f3534b00d14 h1:GnTInK5UIkDJw9alXR4JeOmKmodJu/5qYknZWqp1Sk0=
94-
github.com/btcsuite/btcwallet v0.16.10-0.20240206195028-1f3534b00d14/go.mod h1:3EItwIQcrXGkcQlO1OginQ3Ab8YgE8kxka9hjgFuWxM=
93+
github.com/btcsuite/btcwallet v0.16.10-0.20240305014015-f7c216e78ee8 h1:fkPZ7LfOCm3Nn0Y/56LOqwooYaw9cV/4jZkdHw7XGik=
94+
github.com/btcsuite/btcwallet v0.16.10-0.20240305014015-f7c216e78ee8/go.mod h1:q+J5AzV+ymzUaBXkP099uuVh18yzCyHHXPc4rxi55mk=
9595
github.com/btcsuite/btcwallet/wallet/txauthor v1.3.4 h1:poyHFf7+5+RdxNp5r2T6IBRD7RyraUsYARYbp/7t4D8=
9696
github.com/btcsuite/btcwallet/wallet/txauthor v1.3.4/go.mod h1:GETGDQuyq+VFfH1S/+/7slLM/9aNa4l7P4ejX6dJfb0=
9797
github.com/btcsuite/btcwallet/wallet/txrules v1.2.1 h1:UZo7YRzdHbwhK7Rhv3PO9bXgTxiOH45edK5qdsdiatk=

lnwallet/btcwallet/btcwallet.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import (
1414
"github.com/btcsuite/btcd/btcutil/hdkeychain"
1515
"github.com/btcsuite/btcd/chaincfg"
1616
"github.com/btcsuite/btcd/chaincfg/chainhash"
17+
"github.com/btcsuite/btcd/rpcclient"
1718
"github.com/btcsuite/btcd/txscript"
1819
"github.com/btcsuite/btcd/wire"
1920
"github.com/btcsuite/btcwallet/chain"
@@ -1262,6 +1263,18 @@ func (b *BtcWallet) PublishTransaction(tx *wire.MsgTx, label string) error {
12621263
// or 10,000 sat/vb.
12631264
results, err := b.chain.TestMempoolAccept([]*wire.MsgTx{tx}, 0)
12641265
if err != nil {
1266+
// If the chain backend doesn't support the mempool acceptance
1267+
// test RPC, we'll just attempt to publish the transaction.
1268+
if errors.Is(err, rpcclient.ErrBackendVersion) {
1269+
log.Warnf("TestMempoolAccept not supported by "+
1270+
"backend, consider upgrading %s to a newer "+
1271+
"version", b.chain.BackEnd())
1272+
1273+
err := b.wallet.PublishTransaction(tx, label)
1274+
1275+
return handleErr(err)
1276+
}
1277+
12651278
return err
12661279
}
12671280

0 commit comments

Comments
 (0)