Spawn goroutine to rescan on imported privkeys.

Fixes #34.
This commit is contained in:
Josh Rickmar 2014-01-15 12:26:55 -05:00
parent 74f671b09a
commit 55882173a2

View file

@ -390,12 +390,16 @@ func (a *Account) ImportPrivKey(wif string, rescan bool) error {
}
if rescan {
addrs := map[string]struct{}{
addr: struct{}{},
}
// Do not wait for rescan to finish before returning to the
// caller.
go func() {
addrs := map[string]struct{}{
addr: struct{}{},
}
Rescan(CurrentRPCConn(), bs.Height, addrs)
a.writeDirtyToDisk()
Rescan(CurrentRPCConn(), bs.Height, addrs)
a.writeDirtyToDisk()
}()
}
return nil
}