This replaces the limited script number encoder previously used for block
height with a version that matches the exact format generated by Bitcoin
Core (which can include an additional byte for sign in some cases).
With thanks to Kalpesh Parmar for pointing out that some blocks on the
testnet have coinbase transactions with height encoded in 2 bytes.
Changes coinbase height validation to check for the bytes at the start of
the coinbase script, and ignore everything after them. The validation then
matches Bitcoin Core.
Also update error messages to more closely match latest Bitcoin Core.
Add script verification flags for DER format encoding, low-S signatures
and strict encoding.
Pass script verification flags through to signature parser.
Convert block verification flags to a sub-enum of Block.
Remove DER signature format verification flag from block flags.
Add test transaction with a non-standard DER signature, with the verify
flag set/unset accordingly, to tx_invalid.json and tx_valid.json
The way it was previously done before did not allow to properly derive keys which had their position concealed in the hierarchy.
Signed-off-by: Marc-André Tremblay <marcandre.tr@gmail.com>
By replacing MessageSerializer with an abstract class, methods which
should just call other methods in the same class are now fixed, and
subclasses only have to override a single abstract method instead of
multiple.
Original submission:
```
commit 1c54757f8678c9131ec55c128b8f1d5b6c73c2f9
Author: Dave Collins <davec@conformal.com>
Date: Wed May 6 10:16:18 2015 -0500
Add more script edge condition tests.
This commit adds some tests to the script_valid.json and tx_invalid.json
data which exercise more edge conditions that are not currently being
tested.
```
Via:
https://github.com/bitcoin/bitcoin/pull/6112
This patch primarily enforces block height being present in the coinbase
transaction input, altough it introduces a number of other fixes and
changes to support this.
* VersionTally now returns the number of blocks at or above a version, rather than just at, to enable forward-compatible support (i.e. v3 blocks include all v2 block tests)
* Block version is now explicitely provided in most tests which generate blocks, in order to ensure correct tests are applied
* Block height is now used when generating coinbase transactions
* Added support for the chain parameters to determine which tests apply to a block, so altcoins can override the defaults if needed.
* Added initial checks ahead of full BIP 66 validation checks