Skip to content

Commit 0d4472c

Browse files
committed
lnwallet: skip TestMempoolAccept for old backend versions
1 parent a21e661 commit 0d4472c

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

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)