Skip to content

Commit

Permalink
Sapling: Skip proofs and signatures during fee calculation loop
Browse files Browse the repository at this point in the history
  • Loading branch information
random-zebra committed Dec 17, 2020
1 parent 5d8ba3d commit 6099737
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/sapling/sapling_operation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ OperationResult SaplingOperation::build()

// Build the transaction
txBuilder.SetFee(nFeeRet);
TransactionBuilderResult txResult = txBuilder.Build();
TransactionBuilderResult txResult = txBuilder.Build(true);
auto opTx = txResult.GetTx();

// Check existent tx
Expand Down Expand Up @@ -213,6 +213,16 @@ OperationResult SaplingOperation::build()
}
// Done
fee = nFeeRet;

// Clear dummy signatures/proofs and add real ones
txBuilder.ClearProofsAndSignatures();
TransactionBuilderResult txResult = txBuilder.ProveAndSign();
auto opTx = txResult.GetTx();
// Check existent tx
if (!opTx) {
return errorOut("Failed to build transaction: " + txResult.GetError());
}
finalTx = *opTx;
return OperationResult(true);
}

Expand Down

0 comments on commit 6099737

Please sign in to comment.