WitnessAnchorData only needs to store one witness per JSOutPoint.
This commit is contained in:
@@ -331,7 +331,7 @@ bool AsyncRPCOperation_sendmany::main_impl() {
|
|||||||
uint256 inputAnchor;
|
uint256 inputAnchor;
|
||||||
std::vector<boost::optional<ZCIncrementalWitness>> vInputWitnesses;
|
std::vector<boost::optional<ZCIncrementalWitness>> vInputWitnesses;
|
||||||
pwalletMain->GetNoteWitnesses(vOutPoints, vInputWitnesses, inputAnchor);
|
pwalletMain->GetNoteWitnesses(vOutPoints, vInputWitnesses, inputAnchor);
|
||||||
jsopWitnessAnchorMap[ jso.ToString() ] = WitnessAnchorData{ vInputWitnesses, inputAnchor };
|
jsopWitnessAnchorMap[ jso.ToString() ] = WitnessAnchorData{ vInputWitnesses[0], inputAnchor };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -587,7 +587,6 @@ bool AsyncRPCOperation_sendmany::main_impl() {
|
|||||||
std::vector<JSOutPoint> vOutPoints;
|
std::vector<JSOutPoint> vOutPoints;
|
||||||
std::vector<boost::optional<ZCIncrementalWitness>> vInputWitnesses;
|
std::vector<boost::optional<ZCIncrementalWitness>> vInputWitnesses;
|
||||||
uint256 inputAnchor;
|
uint256 inputAnchor;
|
||||||
WitnessAnchorData wad;
|
|
||||||
int numInputsNeeded = (jsChange>0) ? 1 : 0;
|
int numInputsNeeded = (jsChange>0) ? 1 : 0;
|
||||||
while (numInputsNeeded++ < ZC_NUM_JS_INPUTS && zInputsDeque.size() > 0) {
|
while (numInputsNeeded++ < ZC_NUM_JS_INPUTS && zInputsDeque.size() > 0) {
|
||||||
SendManyInputJSOP t = zInputsDeque.front();
|
SendManyInputJSOP t = zInputsDeque.front();
|
||||||
@@ -596,10 +595,8 @@ bool AsyncRPCOperation_sendmany::main_impl() {
|
|||||||
CAmount noteFunds = std::get<2>(t);
|
CAmount noteFunds = std::get<2>(t);
|
||||||
zInputsDeque.pop_front();
|
zInputsDeque.pop_front();
|
||||||
|
|
||||||
wad = jsopWitnessAnchorMap[ jso.ToString() ];
|
WitnessAnchorData wad = jsopWitnessAnchorMap[ jso.ToString() ];
|
||||||
for (auto & w : wad.witnesses) {
|
vInputWitnesses.push_back(wad.witness);
|
||||||
vInputWitnesses.push_back(w);
|
|
||||||
}
|
|
||||||
if (inputAnchor.IsNull()) {
|
if (inputAnchor.IsNull()) {
|
||||||
inputAnchor = wad.anchor;
|
inputAnchor = wad.anchor;
|
||||||
} else if (inputAnchor != wad.anchor) {
|
} else if (inputAnchor != wad.anchor) {
|
||||||
|
|||||||
@@ -42,9 +42,9 @@ struct AsyncJoinSplitInfo
|
|||||||
CAmount vpub_new = 0;
|
CAmount vpub_new = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
// A struct to help us track the witnesses and anchor for a given JSOutPoint
|
// A struct to help us track the witness and anchor for a given JSOutPoint
|
||||||
struct WitnessAnchorData {
|
struct WitnessAnchorData {
|
||||||
std::vector<boost::optional<ZCIncrementalWitness>> witnesses;
|
boost::optional<ZCIncrementalWitness> witness;
|
||||||
uint256 anchor;
|
uint256 anchor;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user