Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/rawtransaction.cpp
Show First 20 Lines • Show All 1,985 Lines • ▼ Show 20 Lines | UniValue joinpsbts(const Config &config, const JSONRPCRequest &request) { | ||||
// Generate list of shuffled indices for shuffling inputs and outputs of the | // Generate list of shuffled indices for shuffling inputs and outputs of the | ||||
// merged PSBT | // merged PSBT | ||||
std::vector<int> input_indices(merged_psbt.inputs.size()); | std::vector<int> input_indices(merged_psbt.inputs.size()); | ||||
std::iota(input_indices.begin(), input_indices.end(), 0); | std::iota(input_indices.begin(), input_indices.end(), 0); | ||||
std::vector<int> output_indices(merged_psbt.outputs.size()); | std::vector<int> output_indices(merged_psbt.outputs.size()); | ||||
std::iota(output_indices.begin(), output_indices.end(), 0); | std::iota(output_indices.begin(), output_indices.end(), 0); | ||||
// Shuffle input and output indicies lists | // Shuffle input and output indices lists | ||||
Shuffle(input_indices.begin(), input_indices.end(), FastRandomContext()); | Shuffle(input_indices.begin(), input_indices.end(), FastRandomContext()); | ||||
Shuffle(output_indices.begin(), output_indices.end(), FastRandomContext()); | Shuffle(output_indices.begin(), output_indices.end(), FastRandomContext()); | ||||
PartiallySignedTransaction shuffled_psbt; | PartiallySignedTransaction shuffled_psbt; | ||||
shuffled_psbt.tx = CMutableTransaction(); | shuffled_psbt.tx = CMutableTransaction(); | ||||
shuffled_psbt.tx->nVersion = merged_psbt.tx->nVersion; | shuffled_psbt.tx->nVersion = merged_psbt.tx->nVersion; | ||||
shuffled_psbt.tx->nLockTime = merged_psbt.tx->nLockTime; | shuffled_psbt.tx->nLockTime = merged_psbt.tx->nLockTime; | ||||
for (int i : input_indices) { | for (int i : input_indices) { | ||||
▲ Show 20 Lines • Show All 187 Lines • Show Last 20 Lines |