Fixes #1779 so that sending to multiple zaddrs no longer fails.
Commit 2eeb6b randomized the order of input and output notes, but this is now known to prevent the chaining of multiple joinsplits in a single transaction. The root cause has yet to be determined. This patch is a temporary fix and disables the shuffling of input and output notes. It also adds a chained joinsplit test to the python qa test suite.
This commit is contained in:
parent
ce71cd0984
commit
7c463780cf
|
@ -148,5 +148,22 @@ class Wallet2Test (BitcoinTestFramework):
|
||||||
# check balance
|
# check balance
|
||||||
assert_equal(self.nodes[2].getbalance(), 9)
|
assert_equal(self.nodes[2].getbalance(), 9)
|
||||||
|
|
||||||
|
# Check that chained joinsplits in a single tx are created successfully.
|
||||||
|
recipients = []
|
||||||
|
num_recipients = 3
|
||||||
|
amount_per_recipient = Decimal('0.002')
|
||||||
|
for i in xrange(0,num_recipients):
|
||||||
|
newzaddr = self.nodes[2].z_getnewaddress()
|
||||||
|
recipients.append({"address":newzaddr, "amount":amount_per_recipient})
|
||||||
|
myopid = self.nodes[0].z_sendmany(myzaddr, recipients)
|
||||||
|
self.wait_for_operationd_success(myopid)
|
||||||
|
self.sync_all()
|
||||||
|
self.nodes[1].generate(1)
|
||||||
|
self.sync_all()
|
||||||
|
|
||||||
|
# check balances
|
||||||
|
resp = self.nodes[2].z_gettotalbalance()
|
||||||
|
assert_equal(Decimal(resp["private"]), num_recipients * amount_per_recipient)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
Wallet2Test ().main ()
|
Wallet2Test ().main ()
|
||||||
|
|
|
@ -57,8 +57,10 @@ JSDescription JSDescription::Randomized(
|
||||||
// Randomize the order of the inputs and outputs
|
// Randomize the order of the inputs and outputs
|
||||||
inputMap = {0, 1};
|
inputMap = {0, 1};
|
||||||
outputMap = {0, 1};
|
outputMap = {0, 1};
|
||||||
|
if (gen) {
|
||||||
MappedShuffle(inputs.begin(), inputMap.begin(), ZC_NUM_JS_INPUTS, gen);
|
MappedShuffle(inputs.begin(), inputMap.begin(), ZC_NUM_JS_INPUTS, gen);
|
||||||
MappedShuffle(outputs.begin(), outputMap.begin(), ZC_NUM_JS_OUTPUTS, gen);
|
MappedShuffle(outputs.begin(), outputMap.begin(), ZC_NUM_JS_OUTPUTS, gen);
|
||||||
|
}
|
||||||
|
|
||||||
return JSDescription(
|
return JSDescription(
|
||||||
params, pubKeyHash, anchor, inputs, outputs,
|
params, pubKeyHash, anchor, inputs, outputs,
|
||||||
|
|
|
@ -875,6 +875,7 @@ Object AsyncRPCOperation_sendmany::perform_joinsplit(
|
||||||
{info.vjsout[0], info.vjsout[1]};
|
{info.vjsout[0], info.vjsout[1]};
|
||||||
boost::array<size_t, ZC_NUM_JS_INPUTS> inputMap;
|
boost::array<size_t, ZC_NUM_JS_INPUTS> inputMap;
|
||||||
boost::array<size_t, ZC_NUM_JS_OUTPUTS> outputMap;
|
boost::array<size_t, ZC_NUM_JS_OUTPUTS> outputMap;
|
||||||
|
std::function<int(int)> emptyFunc;
|
||||||
JSDescription jsdesc = JSDescription::Randomized(
|
JSDescription jsdesc = JSDescription::Randomized(
|
||||||
*pzcashParams,
|
*pzcashParams,
|
||||||
joinSplitPubKey_,
|
joinSplitPubKey_,
|
||||||
|
@ -885,7 +886,9 @@ Object AsyncRPCOperation_sendmany::perform_joinsplit(
|
||||||
outputMap,
|
outputMap,
|
||||||
info.vpub_old,
|
info.vpub_old,
|
||||||
info.vpub_new,
|
info.vpub_new,
|
||||||
!this->testmode);
|
!this->testmode,
|
||||||
|
// Temporary fix for #1779 is to disable shuffling of inputs and outputs.
|
||||||
|
emptyFunc);
|
||||||
|
|
||||||
if (!(jsdesc.Verify(*pzcashParams, joinSplitPubKey_))) {
|
if (!(jsdesc.Verify(*pzcashParams, joinSplitPubKey_))) {
|
||||||
throw std::runtime_error("error verifying joinsplit");
|
throw std::runtime_error("error verifying joinsplit");
|
||||||
|
|
Loading…
Reference in New Issue