-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
multi: share the same bitcoind connection between multiple rescan clients #1566
multi: share the same bitcoind connection between multiple rescan clients #1566
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK, pending the btcwallet
dependency 👍
config.go
Outdated
RPCUser string `long:"rpcuser" description:"Username for RPC connections"` | ||
RPCPass string `long:"rpcpass" default-mask:"-" description:"Password for RPC connections"` | ||
ZMQBlockHost string `long:"zmqblockhost" description:"The ZMQ host providing raw block notifications"` | ||
ZMQTxHost string `long:"zmqtxhost" description:"The ZMQ host providing raw transaction notifications"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it make sense to call these zmqpubrawtx
and zmqpubrawblock
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
routing/chainview/interface_test.go
Outdated
"github.com/btcsuite/btcwallet/walletdb" | ||
_ "github.com/btcsuite/btcwallet/walletdb/bdb" // Required to register the boltdb walletdb implementation. | ||
|
||
"github.com/lightninglabs/neutrino" | ||
"github.com/ltcsuite/ltcd/btcjson" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
guess this should be btcd
, really
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
Note that this won't build until we're caught up with btcsuite master. |
The dependent |
lnwallet/interface_test.go
Outdated
if err != nil { | ||
t.Fatalf("couldn't start alice client: %v", err) | ||
} | ||
time.Sleep(time.Second) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why's this sleep necessary now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To ensure bitcoind has started before we attempt to connect to it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Has that changed with the new dependency, or is it something that could fail also earlier?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something that could have happened earlier. It's also done within the ChainNotifier
and FilteredChainView
tests.
Needs rebase. |
Due to recent changes to the BitcoindClient interface, we now require the backing bitcoind to use different hosts for its ZMQ raw block and raw transaction notifications. This was needed as the notification queue maintained by the bitcoind node would sometimes overflow with transactions and cause block notifications to be dropped/missed. In this commit, we expand extractBitcoindRPCParams to account for this.
In this commit, we introduce a nice optimization with regards to lnd's interaction with a bitcoind backend. Within lnd, we currently have three different subsystems responsible for watching the chain: chainntnfs, lnwallet, and routing/chainview. Each of these subsystems has an active RPC and ZMQ connection to the underlying bitcoind node. This would incur a toll on the underlying bitcoind node and would cause us to miss ZMQ events, which are crucial to lnd. We remedy this issue by sharing the same connection to a bitcoind node between the different clients within lnd.
} | ||
|
||
// If only one or two of the parameters are set, we assume the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: ...or three 😛
lnwallet/interface_test.go
Outdated
if err != nil { | ||
t.Fatalf("couldn't start alice client: %v", err) | ||
} | ||
time.Sleep(time.Second) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Has that changed with the new dependency, or is it something that could fail also earlier?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 💧
Typo in the docs?
Results in:
|
Whoops, yeah the second should be |
Also, |
So now bitcoin.conf must set different ports for zmq as follows
lnd.conf used to have
however now it must have
??? but the sample lnd.conf file is incorrect? https://github.com/lightningnetwork/lnd/blob/master/sample-lnd.conf ; bitcoind.zmqblockhost=tcp://127.0.0.1:28332 can submit PR if needed? |
See #1717. |
In this PR, we introduce a nice optimization with regards to
lnd
's interaction with abitcoind
backend. Withinlnd
, we currently have three different subsystems responsible for watching the chain:chainntnfs
,lnwallet
, androuting/chainview
. Each of these subsystems has an active RPC and ZMQ connection to the underlyingbitcoind
node. This would incur a toll on the underlyingbitcoind
node and would cause us to miss ZMQ events, which are crucial tolnd
. We remedy this issue by sharing the same connection to abitcoind
node between the different clients withinlnd
.We now also require the backing
bitcoind
node to use different hosts to provide its ZMQ raw block and raw transaction notifications (zmqpubrawblock
andzmqpubrawtx
). This was needed as the notification queue maintained by thebitcoind
node would sometimes overflow with transactions and would cause block notifications to be dropped/missed.Depends on btcsuite/btcwallet#511.
Fixes #1174.