walletdb: better wallet commits.
This commit is contained in:
parent
b98ca596d1
commit
45816e4527
@ -421,9 +421,18 @@ WalletDB.prototype.batch = function batch(wallet) {
|
||||
*/
|
||||
|
||||
WalletDB.prototype.commit = co(function* commit(wallet) {
|
||||
var batch = wallet.current;
|
||||
var batch = this.batch(wallet);
|
||||
|
||||
try {
|
||||
yield batch.write();
|
||||
} catch (e) {
|
||||
wallet.current = null;
|
||||
wallet.accountCache.drop();
|
||||
wallet.pathCache.drop();
|
||||
throw e;
|
||||
}
|
||||
|
||||
wallet.current = null;
|
||||
yield batch.write();
|
||||
wallet.accountCache.commit();
|
||||
wallet.pathCache.commit();
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user