Skip to content

Commit

Permalink
fix(txbuilder): take borrowed mainkey
Browse files Browse the repository at this point in the history
- We need an api to take a single borrowed main key for many dbcs.
  • Loading branch information
oetyng committed Apr 12, 2023
1 parent ef6b308 commit 3523055
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,15 @@ impl TransactionBuilder {
}

/// Add an input given a list of Dbcs and associated MainKeys.
pub fn add_inputs_dbc(
pub fn add_input_dbcs(mut self, main_key: &MainKey, dbcs: &[Dbc]) -> Result<Self> {
for dbc in dbcs.iter() {
self = self.add_input_dbc(dbc, main_key)?;
}
Ok(self)
}

/// Add an input given a list of Dbcs and associated MainKeys.
pub fn add_input_dbcs_with_keys(
mut self,
dbcs: impl IntoIterator<Item = (Dbc, MainKey)>,
) -> Result<Self> {
Expand Down
2 changes: 1 addition & 1 deletion src/spentbook.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ mod tests {
.collect();

let dbc_builder = TransactionBuilder::default()
.add_inputs_dbc(second_inputs_dbcs)?
.add_input_dbcs_with_keys(second_inputs_dbcs)?
.add_outputs(
second_output_key_map
.values()
Expand Down

0 comments on commit 3523055

Please sign in to comment.