mirror of
https://github.com/tendermint/tendermint.git
synced 2026-02-12 06:41:31 +00:00
types: Convert ExtendedCommit.Copy to a deep clone
Signed-off-by: Thane Thomson <connect@thanethomson.com>
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user