From 5cbef663e4fa9f7675e44441e832a4d47c114116 Mon Sep 17 00:00:00 2001 From: "Johan T. Halseth" Date: Tue, 15 Oct 2019 10:31:23 +0200 Subject: [PATCH 1/3] go mod: update btcd+neutrino+btcwallet --- go.mod | 6 +++--- go.sum | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/go.mod b/go.mod index 0a0188dc3..102996837 100644 --- a/go.mod +++ b/go.mod @@ -5,10 +5,10 @@ require ( github.com/NebulousLabs/fastrand v0.0.0-20181203155948-6fb6489aac4e // indirect github.com/NebulousLabs/go-upnp v0.0.0-20180202185039-29b680b06c82 github.com/Yawning/aez v0.0.0-20180114000226-4dad034d9db2 - github.com/btcsuite/btcd v0.0.0-20190824003749-130ea5bddde3 + github.com/btcsuite/btcd v0.20.0-beta github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d - github.com/btcsuite/btcwallet v0.0.0-20191004044542-5f205d607bcb + github.com/btcsuite/btcwallet v0.10.0 github.com/btcsuite/btcwallet/wallet/txauthor v1.0.0 github.com/btcsuite/btcwallet/wallet/txrules v1.0.0 github.com/btcsuite/btcwallet/walletdb v1.1.0 @@ -33,7 +33,7 @@ require ( github.com/juju/utils v0.0.0-20180820210520-bf9cc5bdd62d // indirect github.com/juju/version v0.0.0-20180108022336-b64dbd566305 // indirect github.com/kkdai/bstream v0.0.0-20181106074824-b3251f7901ec - github.com/lightninglabs/neutrino v0.0.0-20190919020618-7cf83626779e + github.com/lightninglabs/neutrino v0.10.0 github.com/lightningnetwork/lightning-onion v0.0.0-20190909101754-850081b08b6a github.com/lightningnetwork/lnd/queue v1.0.1 github.com/lightningnetwork/lnd/ticker v1.0.0 diff --git a/go.sum b/go.sum index 9865e20b1..3dd507fab 100644 --- a/go.sum +++ b/go.sum @@ -21,12 +21,14 @@ github.com/btcsuite/btcd v0.0.0-20190629003639-c26ffa870fd8 h1:mOg8/RgDSHTQ1R0IR github.com/btcsuite/btcd v0.0.0-20190629003639-c26ffa870fd8/go.mod h1:3J08xEfcugPacsc34/LKRU2yO7YmuT8yt28J8k2+rrI= github.com/btcsuite/btcd v0.0.0-20190824003749-130ea5bddde3 h1:A/EVblehb75cUgXA5njHPn0kLAsykn6mJGz7rnmW5W0= github.com/btcsuite/btcd v0.0.0-20190824003749-130ea5bddde3/go.mod h1:3J08xEfcugPacsc34/LKRU2yO7YmuT8yt28J8k2+rrI= +github.com/btcsuite/btcd v0.20.0-beta h1:DnZGUjFbRkpytojHWwy6nfUSA7vFrzWXDLpFNzt74ZA= +github.com/btcsuite/btcd v0.20.0-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f h1:bAs4lUbRJpnnkd9VhRV3jjAVU7DJVjMaK+IsvSeZvFo= github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d h1:yJzD/yFppdVCf6ApMkVy8cUxV0XrxdP9rVf6D87/Mng= github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= -github.com/btcsuite/btcwallet v0.0.0-20191004044542-5f205d607bcb h1:W4l92i/ImG2qx4msNWSzhKqnvfQM3d8weQ27D++lhxk= -github.com/btcsuite/btcwallet v0.0.0-20191004044542-5f205d607bcb/go.mod h1:ntLqUbZ12G8FmPX1nJj7W83WiAFOLRGiuarH4zDYdlI= +github.com/btcsuite/btcwallet v0.10.0 h1:fFZncfYJ7VByePTGttzJc3qfCyDzU95ucZYk0M912lU= +github.com/btcsuite/btcwallet v0.10.0/go.mod h1:4TqBEuceheGNdeLNrelliLHJzmXauMM2vtWfuy1pFiM= github.com/btcsuite/btcwallet/wallet/txauthor v1.0.0 h1:KGHMW5sd7yDdDMkCZ/JpP0KltolFsQcB973brBnfj4c= github.com/btcsuite/btcwallet/wallet/txauthor v1.0.0/go.mod h1:VufDts7bd/zs3GV13f/lXc/0lXrPnvxD/NvmpG/FEKU= github.com/btcsuite/btcwallet/wallet/txrules v1.0.0 h1:2VsfS0sBedcM5KmDzRMT3+b6xobqWveZGvjb+jFez5w= @@ -128,10 +130,8 @@ github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/lightninglabs/gozmq v0.0.0-20190710231225-cea2a031735d h1:tt8hwvxl6fksSfchjBGaWu+pnWJQfG1OWiCM20qOSAE= github.com/lightninglabs/gozmq v0.0.0-20190710231225-cea2a031735d/go.mod h1:vxmQPeIQxPf6Jf9rM8R+B4rKBqLA2AjttNxkFBL2Plk= -github.com/lightninglabs/neutrino v0.0.0-20190906012717-f087198de655 h1:/EpOX/6QvD5CdoAfMt1yvZeUPjJ8sCiHv6CRNG2lEuY= -github.com/lightninglabs/neutrino v0.0.0-20190906012717-f087198de655/go.mod h1:awTrhbCWjWNH4yVwZ4IE7nZbvpQ27e7OyD+jao7wRxA= -github.com/lightninglabs/neutrino v0.0.0-20190919020618-7cf83626779e h1:1xvNaf+0HrwjzuqqI7b0jZFTHb+MpEup4tpG44xhrmE= -github.com/lightninglabs/neutrino v0.0.0-20190919020618-7cf83626779e/go.mod h1:awTrhbCWjWNH4yVwZ4IE7nZbvpQ27e7OyD+jao7wRxA= +github.com/lightninglabs/neutrino v0.10.0 h1:yWVy2cOCCXbKFdpYCE9vD1fWRJDd9FtGXhUws4l9RkU= +github.com/lightninglabs/neutrino v0.10.0/go.mod h1:C3KhCMk1Mcx3j8v0qRVWM1Ow6rIJSvSPnUAq00ZNAfk= github.com/lightningnetwork/lightning-onion v0.0.0-20190909101754-850081b08b6a h1:GoWPN4i4jTKRxhVNh9a2vvBBO1Y2seiJB+SopUYoKyo= github.com/lightningnetwork/lightning-onion v0.0.0-20190909101754-850081b08b6a/go.mod h1:rigfi6Af/KqsF7Za0hOgcyq2PNH4AN70AaMRxcJkff4= github.com/ltcsuite/ltcd v0.0.0-20190101042124-f37f8bf35796 h1:sjOGyegMIhvgfq5oaue6Td+hxZuf3tDC8lAPrFldqFw= From 610a93e2fff012bd2b7d68c0cd604d765b784563 Mon Sep 17 00:00:00 2001 From: "Johan T. Halseth" Date: Fri, 11 Oct 2019 10:15:41 +0200 Subject: [PATCH 2/3] routing/chainview: check GetCFilter error Since the filter will never be nil in non-error cases now, remove the nil-check. --- routing/chainview/neutrino.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/routing/chainview/neutrino.go b/routing/chainview/neutrino.go index 19933736d..792e2dba8 100644 --- a/routing/chainview/neutrino.go +++ b/routing/chainview/neutrino.go @@ -239,11 +239,7 @@ func (c *CfFilteredChainView) FilterBlock(blockHash *chainhash.Hash) (*FilteredB // outpoint that have been spent. filter, err := c.p2pNode.GetCFilter(*blockHash, wire.GCSFilterRegular) if err != nil { - return nil, err - } - - if filter == nil { - return nil, fmt.Errorf("Unable to fetch filter") + return nil, fmt.Errorf("unable to fetch filter: %v", err) } // Before we can match the filter, we'll need to map each item in our From 753f30a6fffe1092409eb142c0624922013fcf8d Mon Sep 17 00:00:00 2001 From: "Johan T. Halseth" Date: Tue, 15 Oct 2019 11:25:31 +0200 Subject: [PATCH 3/3] chainntnfs/neutrino: don't ignore failed filter fetches Earlier GetCFilter could return a nil-error along with a nil-filter in cases where we failed to fetch the filter. We would just ignore the block causing us to miss potential crucial information. Now that GetCFilter will return an error in cases where the fetch failed, the filter will never be nil (even for blocks with only coinbase transactions), and we'll instead return an error. We also increase the number of retries for the filter from the default 2 to 5. --- chainntnfs/neutrinonotify/neutrino.go | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/chainntnfs/neutrinonotify/neutrino.go b/chainntnfs/neutrinonotify/neutrino.go index 410e6789d..dfe6fca3a 100644 --- a/chainntnfs/neutrinonotify/neutrino.go +++ b/chainntnfs/neutrinonotify/neutrino.go @@ -527,19 +527,13 @@ func (n *NeutrinoNotifier) historicalConfDetails(confRequest chainntnfs.ConfRequ // for this height. regFilter, err := n.p2pNode.GetCFilter( *blockHash, wire.GCSFilterRegular, + neutrino.NumRetries(5), ) if err != nil { return nil, fmt.Errorf("unable to retrieve regular filter for "+ "height=%v: %v", scanHeight, err) } - // If the block has no transactions other than the Coinbase - // transaction, then the filter may be nil, so we'll continue - // forward int that case. - if regFilter == nil { - continue - } - // In the case that the filter exists, we'll attempt to see if // any element in it matches our target public key script. key := builder.DeriveKey(blockHash)