Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix MissingInputWithEd25519Address error #2207

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ pub(crate) fn sdruc_not_expired(

impl TransactionBuilder {
pub(crate) fn fulfill_amount_requirement(&mut self) -> Result<(), TransactionBuilderError> {
let (mut input_amount, mut output_amount) = self.amount_balance()?;
let (input_amount, output_amount) = self.amount_balance()?;
if input_amount >= output_amount {
log::debug!("Amount requirement already fulfilled");
return Ok(());
Expand All @@ -43,22 +43,11 @@ impl TransactionBuilder {
if !self.allow_additional_input_selection {
return Err(TransactionBuilderError::AdditionalInputsRequired(Requirement::Amount));
}
if self.available_inputs.is_empty() {
return Err(TransactionBuilderError::InsufficientAmount {
found: input_amount,
required: output_amount,
});
}

while let Some(input) = self.next_input_for_amount(output_amount - input_amount, self.latest_slot_commitment_id)
{
if let Some(input) = self.next_input_for_amount(output_amount - input_amount, self.latest_slot_commitment_id) {
self.requirements.push(Requirement::Amount);
self.select_input(input)?;
(input_amount, output_amount) = self.amount_balance()?;
if input_amount >= output_amount {
break;
}
}
if output_amount > input_amount {
} else {
return Err(TransactionBuilderError::InsufficientAmount {
found: input_amount,
required: output_amount,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ impl TransactionBuilder {
should_recalculate |= self.get_inputs_for_mana_balance()?;

if should_recalculate && !self.requirements.contains(&Requirement::Mana) {
self.requirements.push(Requirement::Mana);
self.requirements.insert(0, Requirement::Mana);
}

Ok(())
Expand Down
Loading