Skip to content

Commit

Permalink
comments about appending outputs to slice of txID
Browse files Browse the repository at this point in the history
  • Loading branch information
bianyuanop committed Jan 20, 2024
1 parent fe47417 commit 94130ac
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions chain/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,9 @@ func (b *StatelessBlock) initializeBuilt(
txID := b.Txs[i].ID()
resultOutput := b.results[i].Output
// [txID + resultOutput]
// txID is a fixed length array, hence [append] will always allocate new memory and copy
// so slice with new address will be returned and no reflect on txID, then later
// we consume those bytes
merkleItems = append(merkleItems, append(txID[:], resultOutput...))
}

Expand Down

0 comments on commit 94130ac

Please sign in to comment.