wallet: eliminate some unneeded database transaction opens/commits
This commit is contained in:
parent
4fb78bca18
commit
fbde9a97c8
1 changed files with 14 additions and 9 deletions
|
@ -56,16 +56,21 @@ func (w *Wallet) handleChainNotifications() {
|
||||||
notificationName = "recvtx/redeemingtx"
|
notificationName = "recvtx/redeemingtx"
|
||||||
case chain.FilteredBlockConnected:
|
case chain.FilteredBlockConnected:
|
||||||
// Atomically update for the whole block.
|
// Atomically update for the whole block.
|
||||||
err = walletdb.Update(w.db, func(tx walletdb.ReadWriteTx) error {
|
if len(n.RelevantTxs) > 0 {
|
||||||
var err error
|
err = walletdb.Update(w.db, func(
|
||||||
for _, rec := range n.RelevantTxs {
|
tx walletdb.ReadWriteTx) error {
|
||||||
err = w.addRelevantTx(tx, rec, n.Block)
|
var err error
|
||||||
if err != nil {
|
for _, rec := range n.RelevantTxs {
|
||||||
return err
|
err = w.addRelevantTx(tx, rec,
|
||||||
|
n.Block)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
return nil
|
||||||
return nil
|
})
|
||||||
})
|
}
|
||||||
|
notificationName = "filteredblockconnected"
|
||||||
|
|
||||||
// The following are handled by the wallet's rescan
|
// The following are handled by the wallet's rescan
|
||||||
// goroutines, so just pass them there.
|
// goroutines, so just pass them there.
|
||||||
|
|
Loading…
Reference in a new issue