Block input bitmap rework (#3236)

* first pass at rewind_single_block
and reworking rewind to simply iterate over blocks, rewinding each incrementally

* commit

* commit

* cleanup

* add test coverage for output_pos index transactional semantics during rewind

* commit

* do not store commitments in spent_index
just use the order of the inputs in the block

* compare key with commitment when cleaning output_pos index

* remove unused OutputPos struct
This commit is contained in:
Antioch Peverell
2020-02-24 09:48:51 +00:00
committed by GitHub
parent ef853ae469
commit cb2b909090
7 changed files with 385 additions and 190 deletions
+2 -2
View File
@@ -56,7 +56,7 @@ pub fn get_output(
match res {
Ok(output_pos) => {
return Ok((
Output::new(&commit, output_pos.height, output_pos.position),
Output::new(&commit, output_pos.height, output_pos.pos),
x.clone(),
));
}
@@ -100,7 +100,7 @@ pub fn get_output_v2(
for x in outputs.iter() {
let res = chain.is_unspent(x);
match res {
Ok(output_pos) => match chain.get_unspent_output_at(output_pos.position) {
Ok(output_pos) => match chain.get_unspent_output_at(output_pos.pos) {
Ok(output) => {
let header = if include_merkle_proof && output.is_coinbase() {
chain.get_header_by_height(output_pos.height).ok()