[WIP] chain: Replace bitcoinconsensus with bitcoinkernel #456
+216
−78
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What is the purpose of this pull request?
Which crates are being modified?
Description
This replaces #418
libbitcoinconsensus is deprecated, and have a sub-optimal performance due to deserializing transactions for every input, even if we are validating them in sequence. Libbitcoinkernel has a wrapper type for transactions, and we pass a & ref to it. We can then create the tx once and pass it as reference to validate each input. This causes a massive perf gain during script validation.
This commit replaces all mentions to libbitcoinconsensus, and replaces with kernel where needed. Notice that we can't use both, because of name clashing on linking time.
Notes to the reviewers
This builds on top of the unmerged bitcoin/bitcoin#30595, using rust-bitcoinkernel. It also can't be built with our MSRV for two reasons:
It uses the cstr_count_bytes feature that was stabilized in 1.81.0.
A build dependency, home, have MSRV of 1.80. Although I did menage to pin this into an older version and it worked.
Checklist
just lint
cargo test