mirror of
https://github.com/FlipsideCrypto/dcrd.git
synced 2026-02-06 10:56:47 +00:00
fullblocktests: Add coinbase nulldata tests.
This adds two new consensus tests to the full block tests for the coinbase nulldata height commitment. The first new test ensures coinbase transactions with the wrong script version are rejected and the second test ensures data pushes that exceed the maximum allowed number of bytes for the coinbase nulldata push are rejected.
This commit is contained in:
parent
893aa30dce
commit
e62a21858b
@ -2477,10 +2477,21 @@ func Generate(includeLargeReorg bool) (tests [][]TestInstance, err error) {
|
||||
})
|
||||
rejected(blockchain.ErrFirstTxNotCoinbase)
|
||||
|
||||
// Create block with an invalid script version in the coinbase block
|
||||
// commitment output.
|
||||
//
|
||||
// ... -> bsb2(18)
|
||||
// \-> bcb2a(19)
|
||||
g.SetTip("bsb2")
|
||||
g.NextBlock("bcb2a", outs[19], ticketOuts[19], func(b *wire.MsgBlock) {
|
||||
b.Transactions[0].TxOut[1].Version = ^uint16(0)
|
||||
})
|
||||
rejected(blockchain.ErrFirstTxNotCoinbase)
|
||||
|
||||
// Create block with too few bytes for the coinbase height commitment.
|
||||
//
|
||||
// ... -> bsb2(18)
|
||||
// \-> bcb2(19)
|
||||
// \-> bcb3(19)
|
||||
g.SetTip("bsb2")
|
||||
g.NextBlock("bcb3", outs[19], ticketOuts[19], func(b *wire.MsgBlock) {
|
||||
script := opReturnScript(repeatOpcode(0x00, 3))
|
||||
@ -2488,6 +2499,17 @@ func Generate(includeLargeReorg bool) (tests [][]TestInstance, err error) {
|
||||
})
|
||||
rejected(blockchain.ErrFirstTxNotCoinbase)
|
||||
|
||||
// Create block with too many bytes for the coinbase height commitment.
|
||||
//
|
||||
// ... -> bsb2(18)
|
||||
// \-> bcb3a(19)
|
||||
g.SetTip("bsb2")
|
||||
g.NextBlock("bcb3a", outs[19], ticketOuts[19], func(b *wire.MsgBlock) {
|
||||
script := opReturnScript(repeatOpcode(0x00, 257))
|
||||
b.Transactions[0].TxOut[1].PkScript = script
|
||||
})
|
||||
rejected(blockchain.ErrFirstTxNotCoinbase)
|
||||
|
||||
// Create block with invalid block height in the coinbase commitment.
|
||||
//
|
||||
// ... -> bsb2(18)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user