dexX7 / java-libbitcoinconsensus

JNA binding and Java wrapper for libbitcoinconsensus
Other
9 stars 3 forks source link

Add about 1045 script verification tests from Bitcoin Core #19

Closed dexX7 closed 8 years ago

dexX7 commented 8 years ago

BitcoinJ is added as test dependency for an easier handling of scripts and transactions.

For data driven script verification tests, test cases are provided as JSON with the following format:

[
  [scriptSig, scriptPubKey, flags, comments],
  [scriptSig, scriptPubKey, flags, comments],
  ...
]

The tests are adopted from Bitcoin Core and added as resource:

Optionally the newly added data driven tests can also be used to test the verification via BitcoinJ, however, this is currently disabled, because BitcoinJ understands only a subset of the scripts properly. In particular the support for certain (not consensus critical) verification flags is mostly missing.

To test BitcoinJ, DataDrivenBitcoinJSpec may be unignored manually.

dexX7 commented 8 years ago

There is some room for refactors, and I'm not really satisfied with the current structure.

Most notably, it's a bit ugly that elements from two projects are mixed (BitcoinJ.Script, BitcoinJ.Transaction and BitcoinConsensus.VerifyFlag), but given that this currently only touches the tests, I'm fine with it for now.