Replace magic 2s in rpcwallet and change > to != for arity checks. Replace magic 2's with named constants in test cases.
This commit is contained in:
parent
24f54da4f2
commit
8cb250885c
|
@ -14,6 +14,7 @@
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "script/script.h"
|
#include "script/script.h"
|
||||||
#include "script/script_error.h"
|
#include "script/script_error.h"
|
||||||
|
#include "primitives/transaction.h"
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
@ -345,11 +346,11 @@ BOOST_AUTO_TEST_CASE(test_basic_pour_verification)
|
||||||
|
|
||||||
// create CPourTx
|
// create CPourTx
|
||||||
CScript scriptPubKey;
|
CScript scriptPubKey;
|
||||||
boost::array<PourInput, 2> inputs = {
|
boost::array<PourInput, NUM_POUR_INPUTS> inputs = {
|
||||||
PourInput(coin, addr, convertVectorToInt(index), path),
|
PourInput(coin, addr, convertVectorToInt(index), path),
|
||||||
PourInput(TEST_TREE_DEPTH) // dummy input of zero value
|
PourInput(TEST_TREE_DEPTH) // dummy input of zero value
|
||||||
};
|
};
|
||||||
boost::array<PourOutput, 2> outputs = {
|
boost::array<PourOutput, NUM_POUR_OUTPUTS> outputs = {
|
||||||
PourOutput(50),
|
PourOutput(50),
|
||||||
PourOutput(50)
|
PourOutput(50)
|
||||||
};
|
};
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
#include "utilmoneystr.h"
|
#include "utilmoneystr.h"
|
||||||
#include "wallet.h"
|
#include "wallet.h"
|
||||||
#include "walletdb.h"
|
#include "walletdb.h"
|
||||||
|
#include "primitives/transaction.h"
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
@ -2514,7 +2515,7 @@ Value zc_raw_pour(const json_spirit::Array& params, bool fHelp)
|
||||||
vpourin.push_back(PourInput(input_coin, zcaddress, path_index, path));
|
vpourin.push_back(PourInput(input_coin, zcaddress, path_index, path));
|
||||||
}
|
}
|
||||||
|
|
||||||
while (vpourin.size() < 2) {
|
while (vpourin.size() < NUM_POUR_INPUTS) {
|
||||||
vpourin.push_back(PourInput(INCREMENTAL_MERKLE_TREE_DEPTH));
|
vpourin.push_back(PourInput(INCREMENTAL_MERKLE_TREE_DEPTH));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2541,13 +2542,13 @@ Value zc_raw_pour(const json_spirit::Array& params, bool fHelp)
|
||||||
vpourout.push_back(output);
|
vpourout.push_back(output);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (vpourout.size() < 2) {
|
while (vpourout.size() < NUM_POUR_OUTPUTS) {
|
||||||
vpourout.push_back(PourOutput(0));
|
vpourout.push_back(PourOutput(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
if (vpourout.size() > 2 || vpourin.size() > 2) {
|
if (vpourout.size() != NUM_POUR_INPUTS || vpourin.size() != NUM_POUR_OUTPUTS) {
|
||||||
throw runtime_error("unsupported");
|
throw runtime_error("unsupported pour input/output counts");
|
||||||
}
|
}
|
||||||
|
|
||||||
CScript scriptPubKey;
|
CScript scriptPubKey;
|
||||||
|
|
Loading…
Reference in New Issue