At
|
|
|
// If the timestamp on the best header is more than 2 hours in the |
|
// past, then we're not yet synced. |
|
minus24Hours := time.Now().Add(-2 * time.Hour) |
|
if blockHeader.Timestamp.Before(minus24Hours) { |
|
return false, bestTimestamp, nil |
|
} |
|
|
we check that a block has been mined within 2 hours in order to ensure synced_to_chain (
|
|
|
// Whether the wallet's view is synced to the main chain |
|
bool synced_to_chain = 9; |
|
|
) is set to
true.
When running in regtest, we are required to manually mine blocks, and we may mine them at arbitrary frequencies. Typically, when we are not testing, we sit idle and don't mine blocks until we are ready to test again.
Also, if we backup and restore a regtest network, if the backup is from some distant time in the past, we have the same thing happen.
We may just be testing off chain stuff and don't want to mine any blocks if we aren't doing any channel open or closure activity.
I feel like on regtest networks, we should not cause LND to trigger not synced after 2 hours if we don't mine any blocks. That can trip up other RPC calls and I don't know that we always necessarily want to do that when testing in regtest mode.
At
lnd/lnwallet/btcwallet/btcwallet.go
Lines 1804 to 1811 in 2c3e6ff
we check that a block has been mined within 2 hours in order to ensure
synced_to_chain(lnd/lnrpc/lightning.proto
Lines 1959 to 1962 in 02f4116
true.When running in regtest, we are required to manually mine blocks, and we may mine them at arbitrary frequencies. Typically, when we are not testing, we sit idle and don't mine blocks until we are ready to test again.
Also, if we backup and restore a regtest network, if the backup is from some distant time in the past, we have the same thing happen.
We may just be testing off chain stuff and don't want to mine any blocks if we aren't doing any channel open or closure activity.
I feel like on regtest networks, we should not cause LND to trigger not synced after 2 hours if we don't mine any blocks. That can trip up other RPC calls and I don't know that we always necessarily want to do that when testing in regtest mode.