From f275391a4993212e1df93c992d86e2c38cd814e1 Mon Sep 17 00:00:00 2001 From: jakubmkowalski Date: Fri, 22 Nov 2024 15:01:06 +0100 Subject: [PATCH] fix: bump order --- transaction/beef.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/transaction/beef.go b/transaction/beef.go index 86cd3a1..1e821f7 100644 --- a/transaction/beef.go +++ b/transaction/beef.go @@ -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) @@ -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 }