Write dirty wallet to disk if a change address is added.

This commit is contained in:
Josh Rickmar 2013-11-06 12:37:46 -05:00
parent e65206f752
commit f809638c72

View file

@ -368,8 +368,15 @@ func SendFrom(reply chan []byte, msg *btcjson.Message) {
return return
} }
// Request updates for change address. // If a change address was added, mark wallet as dirty, sync to disk,
// and Request updates for change address.
if len(createdTx.changeAddr) != 0 {
w.dirty = true
if err := w.writeDirtyToDisk(); err != nil {
log.Errorf("cannot write dirty wallet: %v", err)
}
w.ReqNewTxsForAddress(createdTx.changeAddr) w.ReqNewTxsForAddress(createdTx.changeAddr)
}
// Send rawtx off to btcd // Send rawtx off to btcd
n := <-NewJSONID n := <-NewJSONID
@ -528,8 +535,15 @@ func SendMany(reply chan []byte, msg *btcjson.Message) {
return return
} }
// Request updates for change address. // If a change address was added, mark wallet as dirty, sync to disk,
// and Request updates for change address.
if len(createdTx.changeAddr) != 0 {
w.dirty = true
if err := w.writeDirtyToDisk(); err != nil {
log.Errorf("cannot write dirty wallet: %v", err)
}
w.ReqNewTxsForAddress(createdTx.changeAddr) w.ReqNewTxsForAddress(createdTx.changeAddr)
}
// Send rawtx off to btcd // Send rawtx off to btcd
n := <-NewJSONID n := <-NewJSONID