mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-12-13 15:45:01 +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{
|
witness := transaction.Witness{
|
||||||
VerificationScript: valScript,
|
VerificationScript: valScript,
|
||||||
}
|
}
|
||||||
|
if len(txs) == 0 {
|
||||||
|
txs = []*transaction.Transaction{newMinerTX()}
|
||||||
|
}
|
||||||
b := &block.Block{
|
b := &block.Block{
|
||||||
Base: block.Base{
|
Base: block.Base{
|
||||||
Version: 0,
|
Version: 0,
|
||||||
|
@ -71,7 +74,10 @@ func newBlock(cfg config.ProtocolConfiguration, index uint32, prev util.Uint256,
|
||||||
},
|
},
|
||||||
Transactions: txs,
|
Transactions: txs,
|
||||||
}
|
}
|
||||||
_ = b.RebuildMerkleRoot()
|
err := b.RebuildMerkleRoot()
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
|
||||||
invScript := make([]byte, 0)
|
invScript := make([]byte, 0)
|
||||||
for _, wif := range privNetKeys {
|
for _, wif := range privNetKeys {
|
||||||
|
|
Loading…
Reference in a new issue