From 3d71a28cce2fd7f0f6ea4295d521258d8236760a Mon Sep 17 00:00:00 2001 From: Roei Erez Date: Mon, 16 Mar 2020 09:44:37 +0200 Subject: [PATCH 1/2] build: update dependencies --- go.mod | 2 +- go.sum | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index 63b5e7db..de7f0a9d 100644 --- a/go.mod +++ b/go.mod @@ -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.11.0 + github.com/lightninglabs/neutrino v0.11.1-0.20200316235139-bffc52e8f200 github.com/lightninglabs/protobuf-hex-display v1.3.3-0.20191212020323-b444784ce75d github.com/lightningnetwork/lightning-onion v1.0.1 github.com/lightningnetwork/lnd/cert v1.0.0 diff --git a/go.sum b/go.sum index b8991183..3015a6d4 100644 --- a/go.sum +++ b/go.sum @@ -130,8 +130,9 @@ 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-20191113021534-d20a764486bf h1:HZKvJUHlcXI/f/O0Avg7t8sqkPo78HFzjmeYFl6DPnc= github.com/lightninglabs/gozmq v0.0.0-20191113021534-d20a764486bf/go.mod h1:vxmQPeIQxPf6Jf9rM8R+B4rKBqLA2AjttNxkFBL2Plk= -github.com/lightninglabs/neutrino v0.11.0 h1:lPpYFCtsfJX2W5zI4pWycPmbbBdr7zU+BafYdLoD6k0= github.com/lightninglabs/neutrino v0.11.0/go.mod h1:CuhF0iuzg9Sp2HO6ZgXgayviFTn1QHdSTJlMncK80wg= +github.com/lightninglabs/neutrino v0.11.1-0.20200316235139-bffc52e8f200 h1:j4iZ1XlUAPQmW6oSzMcJGILYsRHNs+4O3Gk+2Ms5Dww= +github.com/lightninglabs/neutrino v0.11.1-0.20200316235139-bffc52e8f200/go.mod h1:MlZmoKa7CJP3eR1s5yB7Rm5aSyadpKkxqAwLQmog7N0= github.com/lightninglabs/protobuf-hex-display v1.3.3-0.20191212020323-b444784ce75d h1:QWD/5MPnaZfUVP7P8wLa4M8Td2DI7XXHXt2vhVtUgGI= github.com/lightninglabs/protobuf-hex-display v1.3.3-0.20191212020323-b444784ce75d/go.mod h1:KDb67YMzoh4eudnzClmvs2FbiLG9vxISmLApUkCa4uI= github.com/lightningnetwork/lightning-onion v1.0.1 h1:qChGgS5+aPxFeR6JiUsGvanei1bn6WJpYbvosw/1604= From ceb454aa16752a387c775459f208f0dd41d5e387 Mon Sep 17 00:00:00 2001 From: Roei Erez Date: Mon, 23 Mar 2020 09:49:51 +0200 Subject: [PATCH 2/2] neutrinonotify: use batch for historical confirmations. This commit introduces an optimization for the chain scanning used in historical confirmations notifications. It now uses batch request instead of requesting filters one by one. --- chainntnfs/neutrinonotify/neutrino.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/chainntnfs/neutrinonotify/neutrino.go b/chainntnfs/neutrinonotify/neutrino.go index dfe6fca3..771c4b86 100644 --- a/chainntnfs/neutrinonotify/neutrino.go +++ b/chainntnfs/neutrinonotify/neutrino.go @@ -523,11 +523,18 @@ func (n *NeutrinoNotifier) historicalConfDetails(confRequest chainntnfs.ConfRequ scanHeight, err) } - // With the hash computed, we can now fetch the basic filter - // for this height. + // With the hash computed, we can now fetch the basic filter for this + // height. Since the range of required items is known we avoid + // roundtrips by requesting a batched response and save bandwidth by + // limiting the max number of items per batch. Since neutrino populates + // its underline filters cache with the batch response, the next call + // will execute a network query only once per batch and not on every + // iteration. regFilter, err := n.p2pNode.GetCFilter( *blockHash, wire.GCSFilterRegular, neutrino.NumRetries(5), + neutrino.OptimisticReverseBatch(), + neutrino.MaxBatchSize(int64(scanHeight-startHeight+1)), ) if err != nil { return nil, fmt.Errorf("unable to retrieve regular filter for "+