multi: fix lint findings from btcd v2 migration
What changed, and why it matters
This commit is mostly a cleanup patch: it wraps long lines caused by a recent library rename and, importantly, adds a missing error check around a call that loads a Bitcoin transaction filter. The error check prevents a silent failure where the node might continue without realizing its filter was not updated, which could affect routing/chain monitoring. There is no direct evidence this is exploitable as a security vulnerability.
Treat as a low-risk reliability fix. Review whether the logged error in routing/chainview/btcd.go should also propagate or trigger a rescan/retry, rather than only logging, to avoid a persistently stale filter state. No urgent security response is indicated.
Security signals we found
Previously unchecked error return now handled
Silent failure in transaction filter update could lead to stale chain view
No input validation, memory safety, or cryptographic changes present
Evidence from the diff
The patch fixes lint findings after migrating to btcd v2. The only functional change is in routing/chainview/btcd.go, where the return value of b.btcdConn.LoadTxFilter(…) is now captured and logged on error. Previously the error was discarded, meaning a failed filter update would go unnoticed. The remaining changes are purely formatting/line-wrapping in input/test_utils.go, zpay32/decode.go, and zpay32/invoice_test.go. No cryptographic, authorization, or consensus-critical logic is changed.
Changed components
routing/chainview/btcd.goinput/test_utils.gozpay32/decode.gozpay32/invoice_test.goInspect captured patch +46 / −14
diff --git a/input/test_utils.go b/input/test_utils.go
index ab9a586..35e8bd2 100644
--- a/input/test_utils.go
+++ b/input/test_utils.go
@@ -223,7 +223,9 @@ func (m *MockSigner) findKey(needleHash160 []byte, singleTweak []byte,
for _, privkey := range m.Privkeys {
// First check whether public key is directly derived from
// private key.
- hash160 := address.Hash160(privkey.PubKey().SerializeCompressed())
+ hash160 := address.Hash160(
+ privkey.PubKey().SerializeCompressed(),
+ )
if bytes.Equal(hash160, needleHash160) {
return privkey
}
@@ -238,7 +240,9 @@ func (m *MockSigner) findKey(needleHash160 []byte, singleTweak []byte,
default:
continue
}
- hash160 = address.Hash160(privkey.PubKey().SerializeCompressed())
+ hash160 = address.Hash160(
+ privkey.PubKey().SerializeCompressed(),
+ )
if bytes.Equal(hash160, needleHash160) {
return privkey
}
diff --git a/routing/chainview/btcd.go b/routing/chainview/btcd.go
index c7091e3..65cc87b 100644
--- a/routing/chainview/btcd.go
+++ b/routing/chainview/btcd.go
@@ -344,8 +344,12 @@ func (b *BtcdFilteredChainView) chainFilterer() {
// Apply the new TX filter to btcd, which will cause
// all following notifications from and calls to it
// return blocks filtered with the new filter.
- b.btcdConn.LoadTxFilter(false, []address.Address{},
- update.newUtxos)
+ err := b.btcdConn.LoadTxFilter(
+ false, []address.Address{}, update.newUtxos,
+ )
+ if err != nil {
+ log.Errorf("Unable to load tx filter: %v", err)
+ }
// All blocks gotten after we loaded the filter will
// have the filter applied, but we will need to rescan
diff --git a/zpay32/decode.go b/zpay32/decode.go
index f009b08..4c66e76 100644
--- a/zpay32/decode.go
+++ b/zpay32/decode.go
@@ -527,7 +527,9 @@ func parseMinFinalCLTVExpiry(data []byte) (*uint64, error) {
// parseFallbackAddr converts the data (encoded in base32) into a fallback
// on-chain address.
-func parseFallbackAddr(data []byte, net *chaincfg.Params) (address.Address, error) { // nolint:dupl
+func parseFallbackAddr(data []byte,
+ net *chaincfg.Params) (address.Address, error) {
+
// Checks if the data is empty or contains a version without an address.
if len(data) < 2 {
return nil, fmt.Errorf("empty fallback address field")
@@ -545,9 +547,13 @@ func parseFallbackAddr(data []byte, net *chaincfg.Params) (address.Address, erro
switch len(witness) {
case 20:
- addr, err = address.NewAddressWitnessPubKeyHash(witness, net)
+ addr, err = address.NewAddressWitnessPubKeyHash(
+ witness, net,
+ )
case 32:
- addr, err = address.NewAddressWitnessScriptHash(witness, net)
+ addr, err = address.NewAddressWitnessScriptHash(
+ witness, net,
+ )
default:
return nil, fmt.Errorf("unknown witness program length %d",
len(witness))
@@ -581,7 +587,9 @@ func parseFallbackAddr(data []byte, net *chaincfg.Params) (address.Address, erro
return nil, err
}
- addr, err = address.NewAddressScriptHashFromHash(scriptHash, net)
+ addr, err = address.NewAddressScriptHashFromHash(
+ scriptHash, net,
+ )
if err != nil {
return nil, err
}
diff --git a/zpay32/invoice_test.go b/zpay32/invoice_test.go
index 08bd5f6..01318ed 100644
--- a/zpay32/invoice_test.go
+++ b/zpay32/invoice_test.go
@@ -66,12 +66,28 @@ var (
testExpiry0 = time.Duration(0) * time.Second
testExpiry60 = time.Duration(60) * time.Second
- testAddrTestnet, _ = address.DecodeAddress("mk2QpYatsKicvFVuTAQLBryyccRXMUaGHP", &chaincfg.TestNet3Params)
- testRustyAddr, _ = address.DecodeAddress("1RustyRX2oai4EYYDpQGWvEL62BBGqN9T", &chaincfg.MainNetParams)
- testAddrMainnetP2SH, _ = address.DecodeAddress("3EktnHQD7RiAE6uzMj2ZifT9YgRrkSgzQX", &chaincfg.MainNetParams)
- testAddrMainnetP2WPKH, _ = address.DecodeAddress("bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4", &chaincfg.MainNetParams)
- testAddrMainnetP2WSH, _ = address.DecodeAddress("bc1qrp33g0q5c5txsp9arysrx4k6zdkfs4nce4xj0gdcccefvpysxf3qccfmv3", &chaincfg.MainNetParams)
- testAddrMainnetP2TR, _ = address.DecodeAddress("bc1pptdvg0d2nj99568"+
+ testAddrTestnet, _ = address.DecodeAddress(
+ "mk2QpYatsKicvFVuTAQLBryyccRXMUaGHP",
+ &chaincfg.TestNet3Params,
+ )
+ testRustyAddr, _ = address.DecodeAddress(
+ "1RustyRX2oai4EYYDpQGWvEL62BBGqN9T",
+ &chaincfg.MainNetParams,
+ )
+ testAddrMainnetP2SH, _ = address.DecodeAddress(
+ "3EktnHQD7RiAE6uzMj2ZifT9YgRrkSgzQX",
+ &chaincfg.MainNetParams,
+ )
+ testAddrMainnetP2WPKH, _ = address.DecodeAddress(
+ "bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4",
+ &chaincfg.MainNetParams,
+ )
+ testAddrMainnetP2WSH, _ = address.DecodeAddress(
+ "bc1qrp33g0q5c5txsp9arysrx4k6zdkfs4nce4xj0"+
+ "gdcccefvpysxf3qccfmv3",
+ &chaincfg.MainNetParams,
+ )
+ testAddrMainnetP2TR, _ = address.DecodeAddress("bc1pptdvg0d2nj99568"+
"qn6ssdy4cygnwuxgw2ukmnwgwz7jpqjz2kszse2s3lm",
&chaincfg.MainNetParams)
Why this scored 20/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.