Skip to content

Commit

Permalink
Fix bug in syncing to address index
Browse files Browse the repository at this point in the history
An ErrSyncToIndex error when calling SyncAccountToAddrIndex simply
indicates that the address manager is ahead of the address pool
index, which is not an error causing any issues. This error is now
caught and skipped.

Fixes #174.
  • Loading branch information
cjepson committed Apr 12, 2016
1 parent bce92a7 commit 5166dcc
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions wallet/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -475,10 +475,16 @@ func (w *Wallet) rescanActiveAddresses() error {
_, err := w.Manager.SyncAccountToAddrIndex(acct,
addressPoolBuffer, branch)
if err != nil {
return fmt.Errorf("failed to create initial waddrmgr "+
"address buffer for the address pool, "+
"account %v, branch %v: %s", acct, branch,
err.Error())
// A ErrSyncToIndex error indicates that we're already
// synced to beyond the end of the account in the
// waddrmgr.
errWaddrmgr, ok := err.(waddrmgr.ManagerError)
if !ok || errWaddrmgr.ErrorCode != waddrmgr.ErrSyncToIndex {
return fmt.Errorf("failed to create initial waddrmgr "+
"address buffer for the address pool, "+
"account %v, branch %v: %s", acct, branch,
err.Error())
}
}
}

Expand Down

0 comments on commit 5166dcc

Please sign in to comment.