[wallet] Specify the policy branch with a map

This commit is contained in:
Alekos Filini
2020-05-16 16:48:31 +02:00
parent c1b01e4d8c
commit fb4abfb99c
3 changed files with 26 additions and 19 deletions

View File

@@ -126,7 +126,7 @@ where
addressees: Vec<(Address, u64)>,
send_all: bool,
fee_perkb: f32,
policy_path: Option<Vec<Vec<usize>>>,
policy_path: Option<BTreeMap<String, Vec<usize>>>,
utxos: Option<Vec<OutPoint>>,
unspendable: Option<Vec<OutPoint>>,
) -> Result<(PSBT, TransactionDetails), Error> {
@@ -134,7 +134,7 @@ where
if policy.requires_path() && policy_path.is_none() {
return Err(Error::SpendingPolicyRequired);
}
let requirements = policy.get_requirements(&policy_path.unwrap_or(vec![]))?;
let requirements = policy.get_requirements(&policy_path.unwrap_or(BTreeMap::new()))?;
debug!("requirements: {:?}", requirements);
let mut tx = Transaction {