Write imported multisig addresses to disk.

When the addmultisigaddress RPC was called, the wallet with the
imported address was not being written to disk, and if no more writes
were scheduled, the address could be lost.  This change immediately
writes the updated keystore to disk before the RPC returns.

Closes #98.
This commit is contained in:
Josh Rickmar 2014-07-07 11:23:53 -05:00
parent ff7ecf5e54
commit 770384be12

View file

@ -1140,6 +1140,12 @@ func AddMultiSigAddress(icmd btcjson.Cmd) (interface{}, error) {
return nil, err
}
// Write wallet with imported multisig address to disk.
AcctMgr.ds.ScheduleWalletWrite(acct)
if err := AcctMgr.ds.FlushAccount(acct); err != nil {
return nil, fmt.Errorf("account write failed: %v", err)
}
// Associate the import address with this account.
AcctMgr.MarkAddressForAccount(address, acct)