waddrmgr/sync: expose verification status in Manager's birthday block methods
This commit is contained in:
parent
6568c433fe
commit
7c377b2906
1 changed files with 17 additions and 6 deletions
|
@ -112,15 +112,26 @@ func (m *Manager) SetBirthday(ns walletdb.ReadWriteBucket,
|
||||||
}
|
}
|
||||||
|
|
||||||
// BirthdayBlock returns the birthday block, or earliest block a key could have
|
// BirthdayBlock returns the birthday block, or earliest block a key could have
|
||||||
// been used, for the manager.
|
// been used, for the manager. A boolean is also returned to indicate whether
|
||||||
func (m *Manager) BirthdayBlock(ns walletdb.ReadBucket) (BlockStamp, error) {
|
// the birthday block has been verified as correct.
|
||||||
return fetchBirthdayBlock(ns)
|
func (m *Manager) BirthdayBlock(ns walletdb.ReadBucket) (BlockStamp, bool, error) {
|
||||||
|
birthdayBlock, err := fetchBirthdayBlock(ns)
|
||||||
|
if err != nil {
|
||||||
|
return BlockStamp{}, false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return birthdayBlock, fetchBirthdayBlockVerification(ns), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetBirthdayBlock sets the birthday block, or earliest time a key could have
|
// SetBirthdayBlock sets the birthday block, or earliest time a key could have
|
||||||
// been used, for the manager.
|
// been used, for the manager. The verified boolean can be used to specify
|
||||||
|
// whether this birthday block should be sanity checked to determine if there
|
||||||
|
// exists a better candidate to prevent less block fetching.
|
||||||
func (m *Manager) SetBirthdayBlock(ns walletdb.ReadWriteBucket,
|
func (m *Manager) SetBirthdayBlock(ns walletdb.ReadWriteBucket,
|
||||||
block BlockStamp) error {
|
block BlockStamp, verified bool) error {
|
||||||
|
|
||||||
return putBirthdayBlock(ns, block)
|
if err := putBirthdayBlock(ns, block); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return putBirthdayBlockVerification(ns, verified)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue