Skip to content

Commit

Permalink
fixup! blockchain, netsync, main, cmd/addblock: Use utxocache
Browse files Browse the repository at this point in the history
  • Loading branch information
kcalvinalvin committed Nov 22, 2023
1 parent ecfedbb commit e47ea95
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions blockchain/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -1188,9 +1188,12 @@ func (b *BlockChain) connectBestChain(node *blockNode, block *btcutil.Block, fla
// to the main chain without violating any rules and without
// actually connecting the block.
if !fastAdd {
// We create a viewpoint here to avoid mutating the utxo cache.
// The block is not considered valid until checkconnectblock
// returns and the mutation would force us to undo the cache.
// We create a viewpoint here to avoid spending or adding new
// coins to the utxo cache.
//
// checkConnectBlock spends and adds utxos before doing the
// signature validation and if the signature validation fails,
// we would be forced to undo the utxo cache.
//
// TODO (kcalvinalvin): Doing all of the validation before connecting
// the tx inside check connect block would allow us to pass the utxo
Expand Down

0 comments on commit e47ea95

Please sign in to comment.