mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-12-12 21:10:36 +00:00
core: ensure we produce correct blocks for tests
Blocks must have at least one transaction and we should check for correct merkle root generation.
This commit is contained in:
parent
e097e86bfa
commit
943d435cd2
1 changed files with 7 additions and 1 deletions
|
@ -59,6 +59,9 @@ func newBlock(cfg config.ProtocolConfiguration, index uint32, prev util.Uint256,
|
|||
witness := transaction.Witness{
|
||||
VerificationScript: valScript,
|
||||
}
|
||||
if len(txs) == 0 {
|
||||
txs = []*transaction.Transaction{newMinerTX()}
|
||||
}
|
||||
b := &block.Block{
|
||||
Base: block.Base{
|
||||
Version: 0,
|
||||
|
@ -71,7 +74,10 @@ func newBlock(cfg config.ProtocolConfiguration, index uint32, prev util.Uint256,
|
|||
},
|
||||
Transactions: txs,
|
||||
}
|
||||
_ = b.RebuildMerkleRoot()
|
||||
err := b.RebuildMerkleRoot()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
invScript := make([]byte, 0)
|
||||
for _, wif := range privNetKeys {
|
||||
|
|
Loading…
Reference in a new issue