diff --git a/go.mod b/go.mod index 2f3a853a..f2cd4829 100644 --- a/go.mod +++ b/go.mod @@ -47,7 +47,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.1-0.20210326011815-f363e0ee1584 + github.com/lightninglabs/neutrino v0.11.1-0.20210429202752-e6974af1494e github.com/lightninglabs/protobuf-hex-display v1.3.3-0.20191212020323-b444784ce75d github.com/lightningnetwork/lightning-onion v1.0.2-0.20200501022730-3c8c8d0b89ea github.com/lightningnetwork/lnd/cert v1.0.3 diff --git a/go.sum b/go.sum index 8e061d08..d8fc8d0d 100644 --- a/go.sum +++ b/go.sum @@ -185,8 +185,8 @@ 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/go.mod h1:CuhF0iuzg9Sp2HO6ZgXgayviFTn1QHdSTJlMncK80wg= -github.com/lightninglabs/neutrino v0.11.1-0.20210326011815-f363e0ee1584 h1:EDsSkmAvl2VqDV1HU7lxof1MPZEvk1DaqPUCTbRBPyc= -github.com/lightninglabs/neutrino v0.11.1-0.20210326011815-f363e0ee1584/go.mod h1:d7zCVUnGmKW1L8DIgdduiCtjEziWMbTL0XhpqQs8zVY= +github.com/lightninglabs/neutrino v0.11.1-0.20210429202752-e6974af1494e h1:bu8vT4/mXk9pX/H5Z/ZPoLYqsI/vEclAu+LafBd5MHk= +github.com/lightninglabs/neutrino v0.11.1-0.20210429202752-e6974af1494e/go.mod h1:d7zCVUnGmKW1L8DIgdduiCtjEziWMbTL0XhpqQs8zVY= 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.2-0.20200501022730-3c8c8d0b89ea h1:oCj48NQ8u7Vz+MmzHqt0db6mxcFZo3Ho7M5gCJauY/k= diff --git a/lncfg/neutrino.go b/lncfg/neutrino.go index f8a84a44..999b5d73 100644 --- a/lncfg/neutrino.go +++ b/lncfg/neutrino.go @@ -15,4 +15,6 @@ type Neutrino struct { UserAgentName string `long:"useragentname" description:"Used to help identify ourselves to other bitcoin peers"` UserAgentVersion string `long:"useragentversion" description:"Used to help identify ourselves to other bitcoin peers"` ValidateChannels bool `long:"validatechannels" description:"Validate every channel in the graph during sync by downloading the containing block. This is the inverse of routing.assumechanvalid, meaning that for Neutrino the validation is turned off by default for massively increased graph sync performance. This speedup comes at the risk of using an unvalidated view of the network for routing. Overwrites the value of routing.assumechanvalid if Neutrino is used. (default: false)"` + BroadcastTimeout time.Duration `long:"broadcasttimeout" description:"The amount of time to wait before giving up on a transaction broadcast attempt."` + PersistFilters bool `long:"persistfilters" description:"Whether compact filters fetched from the P2P network should be persisted to disk."` } diff --git a/lnd.go b/lnd.go index ad03a4a4..14e76eb3 100644 --- a/lnd.go +++ b/lnd.go @@ -1673,6 +1673,8 @@ func initNeutrinoBackend(cfg *Config, chainDir string, }, AssertFilterHeader: headerStateAssertion, BlockCache: blockCache.Cache, + BroadcastTimeout: cfg.NeutrinoMode.BroadcastTimeout, + PersistToDisk: cfg.NeutrinoMode.PersistFilters, } neutrino.MaxPeers = 8 diff --git a/lntest/itest/lnd_test.go b/lntest/itest/lnd_test.go index 5e7dd921..3c2fa586 100644 --- a/lntest/itest/lnd_test.go +++ b/lntest/itest/lnd_test.go @@ -9705,16 +9705,24 @@ func assertDLPExecuted(net *lntest.NetworkHarness, t *harnessTest, assertNumPendingChannels(t, carol, 0, 0) // Make sure Carol got her balance back. - ctxt, _ = context.WithTimeout(ctxb, defaultTimeout) - carolBalResp, err := carol.WalletBalance(ctxt, balReq) + err = wait.NoError(func() error { + ctxt, _ = context.WithTimeout(ctxb, defaultTimeout) + carolBalResp, err := carol.WalletBalance(ctxt, balReq) + if err != nil { + return fmt.Errorf("unable to get carol's balance: %v", err) + } + + carolBalance := carolBalResp.ConfirmedBalance + if carolBalance <= carolStartingBalance { + return fmt.Errorf("expected carol to have balance "+ + "above %d, instead had %v", carolStartingBalance, + carolBalance) + } + + return nil + }, defaultTimeout) if err != nil { - t.Fatalf("unable to get carol's balance: %v", err) - } - carolBalance := carolBalResp.ConfirmedBalance - if carolBalance <= carolStartingBalance { - t.Fatalf("expected carol to have balance above %d, "+ - "instead had %v", carolStartingBalance, - carolBalance) + t.Fatalf(err.Error()) } assertNodeNumChannels(t, dave, 0) diff --git a/lntest/neutrino.go b/lntest/neutrino.go index fe2a2a0b..f16b3e15 100644 --- a/lntest/neutrino.go +++ b/lntest/neutrino.go @@ -27,6 +27,7 @@ func (b NeutrinoBackendConfig) GenArgs() []string { // We enable validating channels so that we can obtain the outpoint for // channels within the graph and make certain assertions based on them. args = append(args, "--neutrino.validatechannels") + args = append(args, "--neutrino.broadcasttimeout=1s") return args } diff --git a/make/testing_flags.mk b/make/testing_flags.mk index 7637d601..569e86f4 100644 --- a/make/testing_flags.mk +++ b/make/testing_flags.mk @@ -68,11 +68,11 @@ LOG_TAGS := nolog endif # If a timeout was requested, construct initialize the proper flag for the go -# test command. If not, we set 20m (up from the default 10m). +# test command. If not, we set 60m (up from the default 10m). ifneq ($(timeout),) TEST_FLAGS += -test.timeout=$(timeout) else -TEST_FLAGS += -test.timeout=40m +TEST_FLAGS += -test.timeout=60m endif GOLIST := go list -tags="$(DEV_TAGS)" -deps $(PKG)/... | grep '$(PKG)'| grep -v '/vendor/' diff --git a/sample-lnd.conf b/sample-lnd.conf index e7bd61c3..3145c740 100644 --- a/sample-lnd.conf +++ b/sample-lnd.conf @@ -491,6 +491,12 @@ bitcoin.node=btcd ; Used to help identify ourselves to other bitcoin peers (default: 0.11.0-beta). ; neutrino.useragentversion=0.11.0-beta +; The amount of time to wait before giving up on a transaction broadcast attempt. +; neutrino.broadcasttimeout=5s + +; Whether compact filters fetched from the P2P network should be persisted to disk. +; neutrino.persistfilters=true + ; Validate every channel in the graph during sync by downloading the containing ; block. This is the inverse of routing.assumechanvalid, meaning that for ; Neutrino the validation is turned off by default for massively increased graph