diff --git a/internal/blocksync/reactor_test.go b/internal/blocksync/reactor_test.go index c8a8c79b8..1d4d7d4d6 100644 --- a/internal/blocksync/reactor_test.go +++ b/internal/blocksync/reactor_test.go @@ -153,7 +153,7 @@ func (rts *reactorTestSuite) addNode( seenExtCommit := &types.ExtendedCommit{} for blockHeight := int64(1); blockHeight <= maxBlockHeight; blockHeight++ { - lastExtCommit = seenExtCommit.Copy() + lastExtCommit = seenExtCommit.Clone() thisBlock := sf.MakeBlock(state, blockHeight, lastExtCommit.StripExtensions()) thisParts, err := thisBlock.MakePartSet(types.BlockPartSizeBytes) diff --git a/types/block.go b/types/block.go index c81caf213..4f0e22751 100644 --- a/types/block.go +++ b/types/block.go @@ -1073,9 +1073,12 @@ type ExtendedCommit struct { bitArray *bits.BitArray } -// Copy creates a copy of this extended commit. -func (ec *ExtendedCommit) Copy() *ExtendedCommit { +// Clone creates a deep copy of this extended commit. +func (ec *ExtendedCommit) Clone() *ExtendedCommit { + sigs := make([]ExtendedCommitSig, len(ec.ExtendedSignatures)) + copy(sigs, ec.ExtendedSignatures) ecc := *ec + ecc.ExtendedSignatures = sigs return &ecc }