From fd2aaff13ce53e32e029b3007a15e94b30a73927 Mon Sep 17 00:00:00 2001 From: Jin Date: Tue, 19 Sep 2023 15:34:20 +0800 Subject: [PATCH] BUG:the problem with value referencing about 'for range' --- core/blockchain/utxo.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/blockchain/utxo.go b/core/blockchain/utxo.go index 02e1225f..633499dc 100644 --- a/core/blockchain/utxo.go +++ b/core/blockchain/utxo.go @@ -182,12 +182,13 @@ func (b *BlockChain) FetchUtxoEntry(outpoint types.TxOutPoint) (*utxo.UtxoEntry, } func (b *BlockChain) dbPutUtxoView(view *utxo.UtxoViewpoint) error { - for outpoint, entry := range view.Entries() { + for op, en := range view.Entries() { + outpoint := op + entry := en // No need to update the database if the entry was not modified. if entry == nil || !entry.IsModified() { continue } - // Remove the utxo entry if it is spent. if entry.IsSpent() { key := utxo.OutpointKey(outpoint)