]> Untitled Git - bdk/commit
Fix policy condition calculation
authorAlekos Filini <alekos.filini@gmail.com>
Fri, 16 Jun 2023 20:49:31 +0000 (13:49 -0700)
committerjunderw <jonathan.underwood4649@gmail.com>
Fri, 16 Jun 2023 20:52:48 +0000 (13:52 -0700)
commit3ccdb84523997d3a9582b1ebd2cf2fe373ddaa55
tree83b692b0ef37a62a87e1353baf03c17dddd5487a
parent15079ee4db321dd55fd32d1cba81be85875faa2f
Fix policy condition calculation
When constructing the `Condition` struct we recursively call
`get_condition` on all the items in a threshold and short-circuit if
there's an error somewhere (for example, because the policy-path hasn't
been provided for a specific threshold).

This can cause issues when the user doesn't care about a subtree, because
we still try to call `get_condition` on all the items and fail if
something is missing, even if the specific subtree isn't selected and
won't be used later on.

This commit changes the logic so that we first filter only the `selected`
items, and then unwrap the error using the question mark. If errors
happened somewhere else they will be ignored, as it should.
src/descriptor/policy.rs
src/wallet/mod.rs