mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2025-02-02 09:40:35 +00:00
consensus: don't duplicate RebuildMerkleRoot in newBlockFromContext
This commit is contained in:
parent
d22286cbbc
commit
b6eef9d275
1 changed files with 1 additions and 7 deletions
|
@ -8,7 +8,6 @@ import (
|
||||||
"github.com/nspcc-dev/dbft"
|
"github.com/nspcc-dev/dbft"
|
||||||
"github.com/nspcc-dev/dbft/block"
|
"github.com/nspcc-dev/dbft/block"
|
||||||
"github.com/nspcc-dev/dbft/crypto"
|
"github.com/nspcc-dev/dbft/crypto"
|
||||||
"github.com/nspcc-dev/dbft/merkle"
|
|
||||||
"github.com/nspcc-dev/dbft/payload"
|
"github.com/nspcc-dev/dbft/payload"
|
||||||
coreb "github.com/nspcc-dev/neo-go/pkg/core/block"
|
coreb "github.com/nspcc-dev/neo-go/pkg/core/block"
|
||||||
"github.com/nspcc-dev/neo-go/pkg/core/blockchainer"
|
"github.com/nspcc-dev/neo-go/pkg/core/blockchainer"
|
||||||
|
@ -475,12 +474,7 @@ func newBlockFromContext(ctx *dbft.Context) block.Block {
|
||||||
|
|
||||||
primaryIndex := uint32(ctx.PrimaryIndex)
|
primaryIndex := uint32(ctx.PrimaryIndex)
|
||||||
block.Block.ConsensusData.PrimaryIndex = primaryIndex
|
block.Block.ConsensusData.PrimaryIndex = primaryIndex
|
||||||
consensusData := coreb.ConsensusData{
|
|
||||||
PrimaryIndex: primaryIndex,
|
|
||||||
Nonce: ctx.Nonce,
|
|
||||||
}
|
|
||||||
|
|
||||||
mt := merkle.NewMerkleTree(append([]util.Uint256{consensusData.Hash()}, ctx.TransactionHashes...)...)
|
block.Block.RebuildMerkleRoot()
|
||||||
block.Block.MerkleRoot = mt.Root().Hash
|
|
||||||
return block
|
return block
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue