Skip to content

Commit

Permalink
fix: bump order
Browse files Browse the repository at this point in the history
  • Loading branch information
jakubmkowalski committed Nov 22, 2024
1 parent 5d90f25 commit f275391
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions transaction/beef.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func (t *Transaction) BEEF() ([]byte, error) {
if err != nil {
return nil, err
}
bumps := map[uint32]*MerklePath{}
bumps := []*MerklePath{}
bumpIndex := map[uint32]int{}
txns := map[string]*Transaction{t.TxID().String(): t}
ancestors, err := t.collectAncestors(txns)
Expand All @@ -112,11 +112,11 @@ func (t *Transaction) BEEF() ([]byte, error) {
if tx.MerklePath == nil {
continue
}
if _, ok := bumps[tx.MerklePath.BlockHeight]; !ok {
if _, ok := bumpIndex[tx.MerklePath.BlockHeight]; !ok {
bumpIndex[tx.MerklePath.BlockHeight] = len(bumps)
bumps[tx.MerklePath.BlockHeight] = tx.MerklePath
bumps = append(bumps, tx.MerklePath)
} else {
err := bumps[tx.MerklePath.BlockHeight].Combine(tx.MerklePath)
err := bumps[bumpIndex[tx.MerklePath.BlockHeight]].Combine(tx.MerklePath)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit f275391

Please sign in to comment.