Skip to content

Commit

Permalink
Merge pull request btcsuite#70 from kcalvinalvin/2023-08-30-add-check…
Browse files Browse the repository at this point in the history
…-to-utreexoviewpoint

blockchain: add assertion check to ProcessUData
  • Loading branch information
kcalvinalvin authored Aug 30, 2023
2 parents 0849b7d + ef8e5fe commit 8da45fa
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion blockchain/utreexoviewpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,12 @@ func (uview *UtreexoViewpoint) ProcessUData(block *btcutil.Block,
return err
}

// Return error if the length of the dels we've extracted do not match the targets.
if len(dels) != len(ud.AccProof.Targets) {
return fmt.Errorf("have %d dels but proof proves %d dels",
len(dels), len(ud.AccProof.Targets))
}

// Update the underlying accumulator.
updateData, err := uview.Modify(ud, adds, dels, ud.RememberIdx)
if err != nil {
Expand Down Expand Up @@ -174,7 +180,6 @@ func BlockToDelOPs(
for _, txin := range tx.MsgTx().TxIn {
// check if on skiplist. If so, don't make leaf
if len(inskip) > 0 && inskip[0] == blockInIdx {
// fmt.Printf("skip %s\n", txin.PreviousOutPoint.String())
inskip = inskip[1:]
blockInIdx++
continue
Expand Down

0 comments on commit 8da45fa

Please sign in to comment.