Skip to content

Commit

Permalink
Mempool: make proving work, add a bunch of tests
Browse files Browse the repository at this point in the history
Now, if you call `get_block_proof` for a block whose outputs we have in
our mempool, we'll get a proof for it.

This commit also adds some tests for mempool stuff
  • Loading branch information
Davidson-Souza committed Jan 30, 2025
1 parent 68b8d95 commit 42e116b
Show file tree
Hide file tree
Showing 3 changed files with 377 additions and 84 deletions.
20 changes: 20 additions & 0 deletions crates/floresta-chain/src/pruned_utreexo/udata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,26 @@ pub mod proof_util {
EmptyStack,
}

pub fn get_script_type(script: &ScriptBuf) -> ScriptPubkeyType {
if script.is_p2pkh() {
return ScriptPubkeyType::PubKeyHash;
}

if script.is_p2sh() {
return ScriptPubkeyType::ScriptHash;
}

if script.is_p2wpkh() {
return ScriptPubkeyType::WitnessV0PubKeyHash;
}

if script.is_p2wsh() {
return ScriptPubkeyType::WitnessV0ScriptHash;
}

ScriptPubkeyType::Other(script.to_bytes().into_boxed_slice())
}

pub fn reconstruct_leaf_data(
leaf: &CompactLeafData,
input: &TxIn,
Expand Down
Loading

0 comments on commit 42e116b

Please sign in to comment.