wallet/wallet: prompt sanity check upon setting new birthday block within ImportPrivateKey
In this commit, we set the verified bit to false upon setting the new birthday block to ensure its correctness as it was provided by the caller.
This commit is contained in:
parent
16ea72e95b
commit
bd95bfa6fb
1 changed files with 6 additions and 2 deletions
|
@ -2684,7 +2684,7 @@ func (w *Wallet) ImportPrivateKey(scope waddrmgr.KeyScope, wif *btcutil.WIF,
|
||||||
// before our current one. Otherwise, if we do, we can
|
// before our current one. Otherwise, if we do, we can
|
||||||
// potentially miss detecting relevant chain events that
|
// potentially miss detecting relevant chain events that
|
||||||
// occurred between them while rescanning.
|
// occurred between them while rescanning.
|
||||||
birthdayBlock, err := w.Manager.BirthdayBlock(addrmgrNs)
|
birthdayBlock, _, err := w.Manager.BirthdayBlock(addrmgrNs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -2696,7 +2696,11 @@ func (w *Wallet) ImportPrivateKey(scope waddrmgr.KeyScope, wif *btcutil.WIF,
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return w.Manager.SetBirthdayBlock(addrmgrNs, *bs)
|
|
||||||
|
// To ensure this birthday block is correct, we'll mark it as
|
||||||
|
// unverified to prompt a sanity check at the next restart to
|
||||||
|
// ensure it is correct as it was provided by the caller.
|
||||||
|
return w.Manager.SetBirthdayBlock(addrmgrNs, *bs, false)
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
|
|
Loading…
Reference in a new issue