Merge pull request #5257 from wpaulino/neutrino-update

lncfg: add config options for new neutrino options
This commit is contained in:
Olaoluwa Osuntokun 2021-04-30 16:54:35 -07:00 committed by GitHub
commit 140dd944c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 33 additions and 14 deletions

2
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

4
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=

@ -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."`
}

2
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

@ -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)

@ -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
}

@ -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/'

@ -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