-
Notifications
You must be signed in to change notification settings - Fork 592
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
chain+wallet: fix race over RescanProgress
message
#891
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, just one nit 🎉
chain/bitcoind_conn.go
Outdated
for { | ||
select { | ||
// Timeout after 30s. | ||
case <-time.After(30 * 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.
Should we extract this into a constant at least or even make it configurable?
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.
updated to make it a constant
chain/bitcoind_conn.go
Outdated
func getBlockHashDuringStartup( | ||
client *rpcclient.Client) (*chainhash.Hash, error) { | ||
|
||
errCode := "-28" |
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: extract to constant above?
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.
updated to make it a constant
8df9fb9
to
c594e4a
Compare
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.
Missed a crucial thing in my first review. Once that's fixed the PR is ready to go though, very nice fixes!
c594e4a
to
062a90f
Compare
We sometimes see this error in test, ``` --- FAIL: TestBitcoindEvents (7.72s) --- FAIL: TestBitcoindEvents/Events_via_RPC_Polling (1.00s) bitcoind_events_test.go:480: Error Trace: /home/runner/work/btcwallet/btcwallet/chain/bitcoind_events_test.go:480 /home/runner/work/btcwallet/btcwallet/chain/bitcoind_events_test.go:49 Error: Received unexpected error: -28: Loading block index… Test: TestBitcoindEvents/Events_via_RPC_Polling FAIL ``` which can also happen in real life if `bitcoind` is still loading blocks. This commit adds a retry logic to wait for `bitcoind` to finish its startup.
062a90f
to
148ac23
Compare
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 🎉
chain+wallet: fix race over `RescanProgress` message
chain+wallet: fix race over `RescanProgress` message
There's a race found in
lnd
side re multiple goroutines accessing theRescanProgress
, details in this PR.It also fixes the case where
bitcoind
is still loading blocks, causing theNewBitcoindConn
to return an error.