From 770384be12c2fd86ab7e20f64434eff8340681a8 Mon Sep 17 00:00:00 2001 From: Josh Rickmar Date: Mon, 7 Jul 2014 11:23:53 -0500 Subject: [PATCH] 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. --- rpcserver.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/rpcserver.go b/rpcserver.go index 947cb59..891dd65 100644 --- a/rpcserver.go +++ b/rpcserver.go @@ -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)