-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: avoid true input inclusion in decoys
We've had some tests cases failing because blst-ringct now verifies that every public_key referenced by a Tx input is unique. But the test cases were obtaining a set of (possibly duplicate) random decoys for each input. So these decoys could duplicate eachother and also any of them could also be a true input. The fix is to refactor TransactionBuilder such that: 1. DecoyInputs are added to a decoy pool within the builder, and the builder removes dups from the pool. 2. ::build() removes any true inputs from the decoys pool and then distributes decoys from the pool amongst the inputs. 3. If there are not enough decoys in the pool then an error is returned -- unless the 'require_all_decoys' setting is false, in which case any remaining inputs receive no decoys. Cargo changes: * only build pprof and benches on unix/linux Code changes: * update tests, bench, mint-repl to use modified builder API * add fields to TransactionBuilder * add decoys_per_input field and set default to 10. * rename TransactionBuilder::add_input_by_true_input to add_true_input() * add API TransactionBuilder::set_decoys_per_input() * add API TransactionBuilder::set_require_all_inputs() * add API TransactionBuilder::add_decoy_inputs() * modify TransactionBuilder::build() to filter true inputs from decoys and distribute decoys amongst inputs * add Error::InsufficientDecoys
- Loading branch information
Showing
7 changed files
with
242 additions
and
159 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.