Skip to content

Commit 6321cda

Browse files
committed
Implement scrub() with per-map field filtering
Key type bytes overlap across PSBT map types. For example, 0x06 is TX_MODIFIABLE in global but BIP32_DERIVATION in inputs. So filtering requires map context. Buffers the global map to detect version and counts (INPUT_COUNT/ OUTPUT_COUNT for v2, UNSIGNED_TX parsed via Transaction::consensus_decode for v0), then streams remaining maps with per-map allowlists for global, input, and output. Pair::decode is pub(crate) in psbt-v2 0.3.0; worked around with a PairDecode extension trait replicating the upstream logic.
1 parent 2f810a3 commit 6321cda

4 files changed

Lines changed: 627 additions & 1 deletion

File tree

Cargo.lock

Lines changed: 138 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/scrubber/Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,7 @@ workspace = true
99
[features]
1010
default = ["unit-tests", "prop-tests"]
1111
unit-tests = []
12-
prop-tests = []
12+
prop-tests = []
13+
14+
[dependencies]
15+
psbt-v2 = "0.3.0"

crates/scrubber/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
11
#![forbid(unsafe_code)]
2+
3+
pub mod scrub;
4+
pub use scrub::{Error, scrub};

0 commit comments

Comments
 (0)