Mark new wallet addresses as belonging to account.
This adds some missing bookkeeping which broke rescans for the root addresses of newly created wallets (not wallets read from disk) by marking all active addresses (which would be just the root address) as belonging to the account with a some particular name. While here, return an error to the caller rather than just logging the error if the newly-created wallet cannot be immediatelly written to disk.
This commit is contained in:
parent
ce2decb275
commit
8b65e651cd
1 changed files with 6 additions and 2 deletions
|
@ -204,6 +204,11 @@ func (store *AccountStore) CreateEncryptedWallet(name, desc string, passphrase [
|
|||
account.UtxoStore.dirty = true
|
||||
account.TxStore.dirty = true
|
||||
|
||||
// Mark all active payment addresses as belonging to this account.
|
||||
for addr := range account.ActivePaymentAddresses() {
|
||||
MarkAddressForAccount(addr, name)
|
||||
}
|
||||
|
||||
// Save the account in the global account map. The mutex is
|
||||
// already held at this point, and will be unlocked when this
|
||||
// func returns.
|
||||
|
@ -218,8 +223,7 @@ func (store *AccountStore) CreateEncryptedWallet(name, desc string, passphrase [
|
|||
|
||||
// Write new wallet to disk.
|
||||
if err := account.writeDirtyToDisk(); err != nil {
|
||||
log.Errorf("cannot sync dirty wallet: %v", err)
|
||||
return nil
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
|
|
Loading…
Reference in a new issue