mirror of
https://github.com/btcsuite/btcd.git
synced 2024-11-19 01:40:07 +01:00
blockchain: Return early on nil utxo view in dbPutUtxoView
This change is part of the effort to add utxocache support to btcd. connectBlock may have an empty utxoviewpoint as the block verification process may be using the utxo cache directly. In that case, a nil utxo viewpoint will be passed in. Just return early on a nil utxoviewpoint.
This commit is contained in:
parent
d86e79eb79
commit
953d62afa7
@ -790,6 +790,10 @@ func dbFetchUtxoEntry(dbTx database.Tx, outpoint wire.OutPoint) (*UtxoEntry, err
|
||||
// particular, only the entries that have been marked as modified are written
|
||||
// to the database.
|
||||
func dbPutUtxoView(dbTx database.Tx, view *UtxoViewpoint) error {
|
||||
// Return early if the view is nil.
|
||||
if view == nil {
|
||||
return nil
|
||||
}
|
||||
utxoBucket := dbTx.Metadata().Bucket(utxoSetBucketName)
|
||||
for outpoint, entry := range view.entries {
|
||||
// No need to update the database if the entry was not modified.
|
||||
|
Loading…
Reference in New Issue
Block a user