lnwallet: increase timeout in waitForWalletSync for new neutrino re-org logic

This commit is contained in:
Olaoluwa Osuntokun 2018-07-31 20:29:39 -07:00
parent 40806532c7
commit f7d9b8e6b0
No known key found for this signature in database
GPG Key ID: 964EA263DD637C21

@ -1738,7 +1738,7 @@ func testReorgWalletBalance(r *rpctest.Harness, w *lnwallet.LightningWallet,
t.Fatalf("unable to synchronize mining nodes: %v", err) t.Fatalf("unable to synchronize mining nodes: %v", err)
} }
// Step 3: Do a set of reorgs by disconecting the two miners, mining // Step 3: Do a set of reorgs by disconnecting the two miners, mining
// one block on the passed miner and two on the created miner, // one block on the passed miner and two on the created miner,
// connecting them, and waiting for them to sync. // connecting them, and waiting for them to sync.
for i := 0; i < 5; i++ { for i := 0; i < 5; i++ {
@ -1918,19 +1918,20 @@ func waitForMempoolTx(r *rpctest.Harness, txid *chainhash.Hash) error {
} }
func waitForWalletSync(r *rpctest.Harness, w *lnwallet.LightningWallet) error { func waitForWalletSync(r *rpctest.Harness, w *lnwallet.LightningWallet) error {
var synced bool var (
var err error synced bool
var bestHash, knownHash *chainhash.Hash err error
var bestHeight, knownHeight int32 bestHash, knownHash *chainhash.Hash
timeout := time.After(10 * time.Second) bestHeight, knownHeight int32
)
timeout := time.After(30 * time.Second)
for !synced { for !synced {
// Do a short wait // Do a short wait
select { select {
case <-timeout: case <-timeout:
return fmt.Errorf("timeout after 10s") return fmt.Errorf("timeout after 30s")
default: case <-time.Tick(50 * time.Millisecond):
} }
time.Sleep(100 * time.Millisecond)
// Check whether the chain source of the wallet is caught up to // Check whether the chain source of the wallet is caught up to
// the harness it's supposed to be catching up to. // the harness it's supposed to be catching up to.