Skip to content

Commit

Permalink
Merge pull request #309 from kcalvinalvin/no-utxo-remember
Browse files Browse the repository at this point in the history
csn/ibd: Don't set UTXOs to be remembered
  • Loading branch information
adiabat authored Aug 16, 2021
2 parents 0c940de + 857aa63 commit 15451ed
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
8 changes: 6 additions & 2 deletions csn/ibd.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,12 @@ func (c *Csn) putBlockInPollard(

remember := make([]bool, len(ub.UtreexoData.TxoTTLs))
for i, ttl := range ub.UtreexoData.TxoTTLs {
// ttl-ub.Height is the number of blocks until the block is spend.
remember[i] = ttl < c.pollard.Lookahead
// 0 means that it's a UTXO. Don't remember.
if ttl == 0 {
remember[i] = false
} else {
remember[i] = ttl < c.pollard.Lookahead
}
}

// get hashes to add into the accumulator
Expand Down
2 changes: 1 addition & 1 deletion util/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ func DedupeBlock(blk *btcutil.Block) (inCount, outCount int, inskip []uint32, ou
for coinbase, tx := range blk.Transactions() {
txOut := tx.MsgTx().TxOut
if coinbase == 0 { // coinbase tx can't be deduped
i += uint32(len(txOut)) // coinbase can have multiple inputs
i += uint32(len(txOut)) // coinbase can have multiple outputs
continue
}

Expand Down
2 changes: 2 additions & 0 deletions wire/umsgblock.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ func BlockToAddLeaves(blk *btcutil.Block,
remember []bool, skiplist []uint32,
height int32, outCount int) (leaves []accumulator.Leaf) {

// We're overallocating a little bit since all the unspendables
// won't be appended. It's ok though for the pre-allocation savings.
leaves = make([]accumulator.Leaf, 0, outCount-len(skiplist))

var txonum uint32
Expand Down

0 comments on commit 15451ed

Please sign in to comment.