[cleanup] replace brackets in includes, update copyrights and use std::array instead of boost::array
This commit is contained in:
parent
1bdadc5b73
commit
18d0083895
19
COPYING
19
COPYING
|
@ -2,6 +2,8 @@ The MIT License (MIT)
|
|||
|
||||
Copyright (c) 2009-2018 The Bitcoin Core developers
|
||||
Copyright (c) 2009-2018 Bitcoin Developers
|
||||
Copyright (c) 2016-2018 The Zcash developers
|
||||
Copyright (c) 2018 The Bitcoin Private Developers
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -20,3 +22,20 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
|
||||
The MIT software license (http://www.opensource.org/licenses/mit-license.php)
|
||||
above applies to the code directly included in this source distribution.
|
||||
Dependencies downloaded as part of the build process may be covered by other
|
||||
open-source licenses. For further details see 'contrib/debian/copyright'.
|
||||
|
||||
|
||||
This product includes software developed by the OpenSSL Project for use in the
|
||||
OpenSSL Toolkit (https://www.openssl.org/). This product includes cryptographic
|
||||
software written by Eric Young (eay@cryptsoft.com).
|
||||
|
||||
|
||||
Although almost all of the Zcash code is licensed under "permissive" open source
|
||||
licenses, users and distributors should note that when built using the default
|
||||
build options, Zcash depends on Oracle Berkeley DB 6.2.x, which is licensed
|
||||
under the GNU Affero General Public License.
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include "asyncrpcoperation.h"
|
||||
#include <asyncrpcoperation.h>
|
||||
|
||||
#include <boost/uuid/uuid.hpp>
|
||||
#include <boost/uuid/uuid_generators.hpp>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include "asyncrpcqueue.h"
|
||||
#include <asyncrpcqueue.h>
|
||||
|
||||
static std::atomic<size_t> workerCounter(0);
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#ifndef ASYNCRPCQUEUE_H
|
||||
#define ASYNCRPCQUEUE_H
|
||||
|
||||
#include "asyncrpcoperation.h"
|
||||
#include <asyncrpcoperation.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include "json_test_vectors.h"
|
||||
#include <json_test_vectors.h>
|
||||
|
||||
UniValue
|
||||
read_json(const std::string& jsondata)
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#include <gtest/gtest.h>
|
||||
|
||||
#include "utilstrencodings.h"
|
||||
#include "version.h"
|
||||
#include "serialize.h"
|
||||
#include "streams.h"
|
||||
#include <utilstrencodings.h>
|
||||
#include <version.h>
|
||||
#include <serialize.h>
|
||||
#include <streams.h>
|
||||
|
||||
#include <univalue.h>
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#include "gmock/gmock.h"
|
||||
#include "crypto/common.h"
|
||||
#include "pubkey.h"
|
||||
#include "zcash/JoinSplit.hpp"
|
||||
#include "util.h"
|
||||
#include <gmock/gmock.h>
|
||||
#include <crypto/common.h>
|
||||
#include <pubkey.h>
|
||||
#include <zcash/JoinSplit.hpp>
|
||||
#include <util.h>
|
||||
|
||||
#include <libsnark/common/default_types/r1cs_ppzksnark_pp.hpp>
|
||||
#include <libsnark/zk_proof_systems/ppzksnark/r1cs_ppzksnark/r1cs_ppzksnark.hpp>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include <gtest/gtest.h>
|
||||
|
||||
#include "primitives/block.h"
|
||||
#include <primitives/block.h>
|
||||
|
||||
|
||||
TEST(block_tests, header_size_is_expected) {
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#include <gtest/gtest.h>
|
||||
#include <gmock/gmock.h>
|
||||
|
||||
#include "consensus/validation.h"
|
||||
#include "main.h"
|
||||
#include "zcash/Proof.hpp"
|
||||
#include <consensus/validation.h>
|
||||
#include <main.h>
|
||||
#include <zcash/Proof.hpp>
|
||||
|
||||
class MockCValidationState : public CValidationState {
|
||||
public:
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
#include <gmock/gmock.h>
|
||||
#include <sodium.h>
|
||||
|
||||
#include "main.h"
|
||||
#include "primitives/transaction.h"
|
||||
#include "consensus/validation.h"
|
||||
#include <validation.h>
|
||||
#include <primitives/transaction.h>
|
||||
#include <consensus/validation.h>
|
||||
|
||||
TEST(checktransaction_tests, check_vpub_not_both_nonzero) {
|
||||
CMutableTransaction tx;
|
||||
|
@ -54,7 +54,7 @@ CMutableTransaction GetValidTransaction() {
|
|||
mtx.vin[1].prevout.hash = uint256S("0000000000000000000000000000000000000000000000000000000000000002");
|
||||
mtx.vin[1].prevout.n = 0;
|
||||
mtx.vout.resize(2);
|
||||
// mtx.vout[0].scriptPubKey =
|
||||
// mtx.vout[0].scriptPubKey =
|
||||
mtx.vout[0].nValue = 0;
|
||||
mtx.vout[1].nValue = 0;
|
||||
mtx.vjoinsplit.resize(2);
|
||||
|
@ -771,4 +771,4 @@ TEST(checktransaction_tests, BadTxReceivedOverNetwork)
|
|||
FAIL() << "Expected std::ios_base::failure 'Unknown transaction format', got some other exception";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include <gtest/gtest.h>
|
||||
#include "uint256.h"
|
||||
#include <uint256.h>
|
||||
|
||||
#include "zcash/util.h"
|
||||
#include <zcash/util.h>
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/format.hpp>
|
||||
|
@ -12,13 +12,13 @@
|
|||
#include <libsnark/gadgetlib1/gadgets/hashes/sha256/sha256_gadget.hpp>
|
||||
#include <libsnark/gadgetlib1/gadgets/merkle_tree/merkle_tree_check_read_gadget.hpp>
|
||||
|
||||
#include "zcash/IncrementalMerkleTree.hpp"
|
||||
#include <zcash/IncrementalMerkleTree.hpp>
|
||||
|
||||
using namespace libsnark;
|
||||
using namespace libzcash;
|
||||
|
||||
#include "zcash/circuit/utils.tcc"
|
||||
#include "zcash/circuit/merkle.tcc"
|
||||
#include <zcash/circuit/utils.tcc>
|
||||
#include <zcash/circuit/merkle.tcc>
|
||||
|
||||
template<typename FieldT>
|
||||
void test_value_equals(uint64_t i) {
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
#include <gmock/gmock.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "clientversion.h"
|
||||
#include "deprecation.h"
|
||||
#include "init.h"
|
||||
#include "ui_interface.h"
|
||||
#include "util.h"
|
||||
#include "chainparams.h"
|
||||
#include <clientversion.h>
|
||||
#include <deprecation.h>
|
||||
#include <init.h>
|
||||
#include <ui_interface.h>
|
||||
#include <util.h>
|
||||
#include <chainparams.h>
|
||||
|
||||
using ::testing::StrictMock;
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
#if defined(HAVE_CONFIG_H)
|
||||
#include "config/bitcoin-config.h"
|
||||
#include <config/bitcoin-config.h>
|
||||
#endif
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <gmock/gmock.h>
|
||||
|
||||
#include "crypto/equihash.h"
|
||||
#include "uint256.h"
|
||||
#include <crypto/equihash.h>
|
||||
#include <uint256.h>
|
||||
|
||||
void TestExpandAndCompress(const std::string &scope, size_t bit_len, size_t byte_pad,
|
||||
std::vector<unsigned char> compact,
|
||||
|
|
|
@ -1,195 +0,0 @@
|
|||
#include <gtest/gtest.h>
|
||||
|
||||
#include "main.h"
|
||||
#include "utilmoneystr.h"
|
||||
#include "chainparams.h"
|
||||
#include "utilstrencodings.h"
|
||||
#include "zcash/Address.hpp"
|
||||
#include "wallet/wallet.h"
|
||||
#include "amount.h"
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <set>
|
||||
#include <vector>
|
||||
#include <boost/filesystem.hpp>
|
||||
#include "util.h"
|
||||
|
||||
// To run tests:
|
||||
// ./zcash-gtest --gtest_filter="founders_reward_test.*"
|
||||
|
||||
//
|
||||
// Enable this test to generate and print 48 testnet 2-of-3 multisig addresses.
|
||||
// The output can be copied into chainparams.cpp.
|
||||
// The temporary wallet file can be renamed as wallet.dat and used for testing with zcashd.
|
||||
//
|
||||
#if 0
|
||||
TEST(founders_reward_test, create_testnet_2of3multisig) {
|
||||
ECC_Start();
|
||||
SelectParams(CBaseChainParams::TESTNET);
|
||||
boost::filesystem::path pathTemp = boost::filesystem::temp_directory_path() / boost::filesystem::unique_path();
|
||||
boost::filesystem::create_directories(pathTemp);
|
||||
mapArgs["-datadir"] = pathTemp.string();
|
||||
bool fFirstRun;
|
||||
auto pWallet = std::make_shared<CWallet>("wallet.dat");
|
||||
ASSERT_EQ(DB_LOAD_OK, pWallet->LoadWallet(fFirstRun));
|
||||
pWallet->TopUpKeyPool();
|
||||
std::cout << "Test wallet and logs saved in folder: " << pathTemp.native() << std::endl;
|
||||
|
||||
int numKeys = 48;
|
||||
std::vector<CPubKey> pubkeys;
|
||||
pubkeys.resize(3);
|
||||
CPubKey newKey;
|
||||
std::vector<std::string> addresses;
|
||||
for (int i = 0; i < numKeys; i++) {
|
||||
ASSERT_TRUE(pWallet->GetKeyFromPool(newKey));
|
||||
pubkeys[0] = newKey;
|
||||
pWallet->SetAddressBook(newKey.GetID(), "", "receive");
|
||||
|
||||
ASSERT_TRUE(pWallet->GetKeyFromPool(newKey));
|
||||
pubkeys[1] = newKey;
|
||||
pWallet->SetAddressBook(newKey.GetID(), "", "receive");
|
||||
|
||||
ASSERT_TRUE(pWallet->GetKeyFromPool(newKey));
|
||||
pubkeys[2] = newKey;
|
||||
pWallet->SetAddressBook(newKey.GetID(), "", "receive");
|
||||
|
||||
CScript result = GetScriptForMultisig(2, pubkeys);
|
||||
ASSERT_FALSE(result.size() > MAX_SCRIPT_ELEMENT_SIZE);
|
||||
CScriptID innerID(result);
|
||||
pWallet->AddCScript(result);
|
||||
pWallet->SetAddressBook(innerID, "", "receive");
|
||||
|
||||
std::string address = CBitcoinAddress(innerID).ToString();
|
||||
addresses.push_back(address);
|
||||
}
|
||||
|
||||
// Print out the addresses, 4 on each line.
|
||||
std::string s = "vFoundersRewardAddress = {\n";
|
||||
int i=0;
|
||||
int colsPerRow = 4;
|
||||
ASSERT_TRUE(numKeys % colsPerRow == 0);
|
||||
int numRows = numKeys/colsPerRow;
|
||||
for (int row=0; row<numRows; row++) {
|
||||
s += " ";
|
||||
for (int col=0; col<colsPerRow; col++) {
|
||||
s += "\"" + addresses[i++] + "\", ";
|
||||
}
|
||||
s += "\n";
|
||||
}
|
||||
s += " };";
|
||||
std::cout << s << std::endl;
|
||||
|
||||
pWallet->Flush(true);
|
||||
|
||||
ECC_Stop();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
// Utility method to check the number of unique addresses from height 1 to maxHeight
|
||||
void checkNumberOfUniqueAddresses(int nUnique) {
|
||||
int maxHeight = Params().GetConsensus().GetLastFoundersRewardBlockHeight();
|
||||
std::set<std::string> addresses;
|
||||
for (int i = 1; i <= maxHeight; i++) {
|
||||
addresses.insert(Params().GetFoundersRewardAddressAtHeight(i));
|
||||
}
|
||||
ASSERT_TRUE(addresses.size() == nUnique);
|
||||
}
|
||||
|
||||
|
||||
TEST(founders_reward_test, general) {
|
||||
SelectParams(CBaseChainParams::TESTNET);
|
||||
|
||||
CChainParams params = Params();
|
||||
|
||||
// Fourth testnet reward:
|
||||
// address = t2ENg7hHVqqs9JwU5cgjvSbxnT2a9USNfhy
|
||||
// script.ToString() = OP_HASH160 55d64928e69829d9376c776550b6cc710d427153 OP_EQUAL
|
||||
// HexStr(script) = a91455d64928e69829d9376c776550b6cc710d42715387
|
||||
EXPECT_EQ(params.GetFoundersRewardScriptAtHeight(1), ParseHex("a914ef775f1f997f122a062fff1a2d7443abd1f9c64287"));
|
||||
EXPECT_EQ(params.GetFoundersRewardAddressAtHeight(1), "t2UNzUUx8mWBCRYPRezvA363EYXyEpHokyi");
|
||||
EXPECT_EQ(params.GetFoundersRewardScriptAtHeight(53126), ParseHex("a914ac67f4c072668138d88a86ff21b27207b283212f87"));
|
||||
EXPECT_EQ(params.GetFoundersRewardAddressAtHeight(53126), "t2NGQjYMQhFndDHguvUw4wZdNdsssA6K7x2");
|
||||
EXPECT_EQ(params.GetFoundersRewardScriptAtHeight(53127), ParseHex("a91455d64928e69829d9376c776550b6cc710d42715387"));
|
||||
EXPECT_EQ(params.GetFoundersRewardAddressAtHeight(53127), "t2ENg7hHVqqs9JwU5cgjvSbxnT2a9USNfhy");
|
||||
|
||||
int maxHeight = params.GetConsensus().GetLastFoundersRewardBlockHeight();
|
||||
|
||||
// If the block height parameter is out of bounds, there is an assert.
|
||||
EXPECT_DEATH(params.GetFoundersRewardScriptAtHeight(0), "nHeight");
|
||||
EXPECT_DEATH(params.GetFoundersRewardScriptAtHeight(maxHeight+1), "nHeight");
|
||||
EXPECT_DEATH(params.GetFoundersRewardAddressAtHeight(0), "nHeight");
|
||||
EXPECT_DEATH(params.GetFoundersRewardAddressAtHeight(maxHeight+1), "nHeight");
|
||||
}
|
||||
|
||||
|
||||
#define NUM_MAINNET_FOUNDER_ADDRESSES 48
|
||||
|
||||
TEST(founders_reward_test, mainnet) {
|
||||
SelectParams(CBaseChainParams::MAIN);
|
||||
checkNumberOfUniqueAddresses(NUM_MAINNET_FOUNDER_ADDRESSES);
|
||||
}
|
||||
|
||||
|
||||
#define NUM_TESTNET_FOUNDER_ADDRESSES 48
|
||||
|
||||
TEST(founders_reward_test, testnet) {
|
||||
SelectParams(CBaseChainParams::TESTNET);
|
||||
checkNumberOfUniqueAddresses(NUM_TESTNET_FOUNDER_ADDRESSES);
|
||||
}
|
||||
|
||||
|
||||
#define NUM_REGTEST_FOUNDER_ADDRESSES 1
|
||||
|
||||
TEST(founders_reward_test, regtest) {
|
||||
SelectParams(CBaseChainParams::REGTEST);
|
||||
checkNumberOfUniqueAddresses(NUM_REGTEST_FOUNDER_ADDRESSES);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Test that 10% founders reward is fully rewarded after the first halving and slow start shift.
|
||||
// On Mainnet, this would be 2,100,000 ZEC after 850,000 blocks (840,000 + 10,000).
|
||||
TEST(founders_reward_test, slow_start_subsidy) {
|
||||
SelectParams(CBaseChainParams::MAIN);
|
||||
CChainParams params = Params();
|
||||
|
||||
int maxHeight = params.GetConsensus().GetLastFoundersRewardBlockHeight();
|
||||
CAmount totalSubsidy = 0;
|
||||
for (int nHeight = 1; nHeight <= maxHeight; nHeight++) {
|
||||
CAmount nSubsidy = GetBlockSubsidy(nHeight, params.GetConsensus()) / 5;
|
||||
totalSubsidy += nSubsidy;
|
||||
}
|
||||
|
||||
ASSERT_TRUE(totalSubsidy == MAX_MONEY/10.0);
|
||||
}
|
||||
|
||||
|
||||
// For use with mainnet and testnet which each have 48 addresses.
|
||||
// Verify the number of rewards each individual address receives.
|
||||
void verifyNumberOfRewards() {
|
||||
CChainParams params = Params();
|
||||
int maxHeight = params.GetConsensus().GetLastFoundersRewardBlockHeight();
|
||||
std::multiset<std::string> ms;
|
||||
for (int nHeight = 1; nHeight <= maxHeight; nHeight++) {
|
||||
ms.insert(params.GetFoundersRewardAddressAtHeight(nHeight));
|
||||
}
|
||||
|
||||
ASSERT_TRUE(ms.count(params.GetFoundersRewardAddressAtIndex(0)) == 17708);
|
||||
for (int i = 1; i <= 46; i++) {
|
||||
ASSERT_TRUE(ms.count(params.GetFoundersRewardAddressAtIndex(i)) == 17709);
|
||||
}
|
||||
ASSERT_TRUE(ms.count(params.GetFoundersRewardAddressAtIndex(47)) == 17677);
|
||||
}
|
||||
|
||||
// Verify the number of rewards going to each mainnet address
|
||||
TEST(founders_reward_test, per_address_reward_mainnet) {
|
||||
SelectParams(CBaseChainParams::MAIN);
|
||||
verifyNumberOfRewards();
|
||||
}
|
||||
|
||||
// Verify the number of rewards going to each testnet address
|
||||
TEST(founders_reward_test, per_address_reward_testnet) {
|
||||
SelectParams(CBaseChainParams::TESTNET);
|
||||
verifyNumberOfRewards();
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
#include <gtest/gtest.h>
|
||||
#include <gmock/gmock.h>
|
||||
|
||||
#include "httprpc.cpp"
|
||||
#include "httpserver.h"
|
||||
#include <httprpc.cpp>
|
||||
#include <httpserver.h>
|
||||
|
||||
using ::testing::Return;
|
||||
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
#include <gtest/gtest.h>
|
||||
|
||||
#include "utilstrencodings.h"
|
||||
#include <utilstrencodings.h>
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
#include "zcash/prf.h"
|
||||
#include "util.h"
|
||||
#include <zcash/prf.h>
|
||||
#include <util.h>
|
||||
|
||||
#include "zcash/JoinSplit.hpp"
|
||||
#include "zcash/Note.hpp"
|
||||
#include "zcash/NoteEncryption.hpp"
|
||||
#include "zcash/IncrementalMerkleTree.hpp"
|
||||
#include <zcash/JoinSplit.hpp>
|
||||
#include <zcash/Note.hpp>
|
||||
#include <zcash/NoteEncryption.hpp>
|
||||
#include <zcash/IncrementalMerkleTree.hpp>
|
||||
|
||||
using namespace libzcash;
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
#include <gtest/gtest.h>
|
||||
|
||||
#include "keystore.h"
|
||||
#include "random.h"
|
||||
#include <keystore.h>
|
||||
#include <random.h>
|
||||
#ifdef ENABLE_WALLET
|
||||
#include "wallet/crypter.h"
|
||||
#include <wallet/crypter.h>
|
||||
#endif
|
||||
#include "zcash/Address.hpp"
|
||||
#include <zcash/Address.hpp>
|
||||
|
||||
TEST(keystore_tests, store_and_retrieve_spending_key) {
|
||||
CBasicKeyStore keyStore;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include <gtest/gtest.h>
|
||||
#include "zcash/util.h"
|
||||
#include <zcash/util.h>
|
||||
|
||||
TEST(libzcash_utils, convertBytesVectorToVector)
|
||||
{
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
#include <gtest/gtest.h>
|
||||
#include <gtest/gtest-spi.h>
|
||||
|
||||
#include "consensus/upgrades.h"
|
||||
#include "consensus/validation.h"
|
||||
#include "core_io.h"
|
||||
#include "main.h"
|
||||
#include "primitives/transaction.h"
|
||||
#include "txmempool.h"
|
||||
#include "policy/fees.h"
|
||||
#include "util.h"
|
||||
#include <consensus/upgrades.h>
|
||||
#include <consensus/validation.h>
|
||||
#include <core_io.h>
|
||||
#include <main.h>
|
||||
#include <primitives/transaction.h>
|
||||
#include <txmempool.h>
|
||||
#include <policy/fees.h>
|
||||
#include <util.h>
|
||||
|
||||
// Implementation is in test_checktransaction.cpp
|
||||
extern CMutableTransaction GetValidTransaction();
|
||||
|
|
|
@ -1,23 +1,23 @@
|
|||
#include <gtest/gtest.h>
|
||||
|
||||
#include "test/data/merkle_roots.json.h"
|
||||
#include "test/data/merkle_roots_empty.json.h"
|
||||
#include "test/data/merkle_serialization.json.h"
|
||||
#include "test/data/merkle_witness_serialization.json.h"
|
||||
#include "test/data/merkle_path.json.h"
|
||||
#include "test/data/merkle_commitments.json.h"
|
||||
#include <test/data/merkle_roots.json.h>
|
||||
#include <test/data/merkle_roots_empty.json.h>
|
||||
#include <test/data/merkle_serialization.json.h>
|
||||
#include <test/data/merkle_witness_serialization.json.h>
|
||||
#include <test/data/merkle_path.json.h>
|
||||
#include <test/data/merkle_commitments.json.h>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
#include "utilstrencodings.h"
|
||||
#include "version.h"
|
||||
#include "serialize.h"
|
||||
#include "streams.h"
|
||||
#include <utilstrencodings.h>
|
||||
#include <version.h>
|
||||
#include <serialize.h>
|
||||
#include <streams.h>
|
||||
|
||||
#include "zcash/IncrementalMerkleTree.hpp"
|
||||
#include "zcash/util.h"
|
||||
#include <zcash/IncrementalMerkleTree.hpp>
|
||||
#include <zcash/util.h>
|
||||
|
||||
#include <libsnark/common/default_types/r1cs_ppzksnark_pp.hpp>
|
||||
#include <libsnark/zk_proof_systems/ppzksnark/r1cs_ppzksnark/r1cs_ppzksnark.hpp>
|
||||
|
@ -26,7 +26,7 @@
|
|||
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
#include "json_test_vectors.h"
|
||||
#include <json_test_vectors.h>
|
||||
|
||||
using namespace std;
|
||||
using namespace libsnark;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include <gtest/gtest.h>
|
||||
|
||||
#include "metrics.h"
|
||||
#include "utiltime.h"
|
||||
#include <metrics.h>
|
||||
#include <utiltime.h>
|
||||
|
||||
|
||||
TEST(Metrics, AtomicTimer) {
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
#include <gmock/gmock.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "chainparams.h"
|
||||
#include "key.h"
|
||||
#include "miner.h"
|
||||
#include "util.h"
|
||||
#include <chainparams.h>
|
||||
#include <key.h>
|
||||
#include <miner.h>
|
||||
#include <util.h>
|
||||
#ifdef ENABLE_WALLET
|
||||
#include "wallet/wallet.h"
|
||||
#include <wallet/wallet.h>
|
||||
#endif
|
||||
|
||||
#include <boost/optional.hpp>
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
#include <gtest/gtest.h>
|
||||
#include "sodium.h"
|
||||
#include <sodium.h>
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
#include "zcash/NoteEncryption.hpp"
|
||||
#include "zcash/prf.h"
|
||||
#include "crypto/sha256.h"
|
||||
#include <zcash/NoteEncryption.hpp>
|
||||
#include <zcash/prf.h>
|
||||
#include <crypto/sha256.h>
|
||||
|
||||
class TestNoteDecryption : public ZCNoteDecryption {
|
||||
public:
|
||||
|
|
|
@ -1,24 +1,24 @@
|
|||
#include <gtest/gtest.h>
|
||||
|
||||
#include "main.h"
|
||||
#include "utilmoneystr.h"
|
||||
#include "chainparams.h"
|
||||
#include "utilstrencodings.h"
|
||||
#include "zcash/Address.hpp"
|
||||
#include "wallet/wallet.h"
|
||||
#include "amount.h"
|
||||
#include <main.h>
|
||||
#include <utilmoneystr.h>
|
||||
#include <chainparams.h>
|
||||
#include <utilstrencodings.h>
|
||||
#include <zcash/Address.hpp>
|
||||
#include <wallet/wallet.h>
|
||||
#include <amount.h>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <set>
|
||||
#include <vector>
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <iostream>
|
||||
#include "util.h"
|
||||
#include <util.h>
|
||||
|
||||
#include "paymentdisclosure.h"
|
||||
#include "paymentdisclosuredb.h"
|
||||
#include <paymentdisclosure.h>
|
||||
#include <paymentdisclosuredb.h>
|
||||
|
||||
#include "sodium.h"
|
||||
#include <sodium.h>
|
||||
|
||||
#include <boost/uuid/uuid.hpp>
|
||||
#include <boost/uuid/uuid_generators.hpp>
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#include <gtest/gtest.h>
|
||||
|
||||
#include "chain.h"
|
||||
#include "chainparams.h"
|
||||
#include "pow.h"
|
||||
#include "random.h"
|
||||
#include <chain.h>
|
||||
#include <chainparams.h>
|
||||
#include <pow.h>
|
||||
#include <random.h>
|
||||
|
||||
TEST(PoW, DifficultyAveraging) {
|
||||
SelectParams(CBaseChainParams::MAIN);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include <gtest/gtest.h>
|
||||
#include "zcash/Proof.hpp"
|
||||
#include <zcash/Proof.hpp>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
|
@ -17,9 +17,9 @@ typedef libsnark::default_r1cs_ppzksnark_pp::Fp_type curve_Fr;
|
|||
typedef libsnark::default_r1cs_ppzksnark_pp::Fq_type curve_Fq;
|
||||
typedef libsnark::default_r1cs_ppzksnark_pp::Fqe_type curve_Fq2;
|
||||
|
||||
#include "streams.h"
|
||||
#include "version.h"
|
||||
#include "utilstrencodings.h"
|
||||
#include <streams.h>
|
||||
#include <version.h>
|
||||
#include <utilstrencodings.h>
|
||||
|
||||
TEST(proofs, g1_pairing_at_infinity)
|
||||
{
|
||||
|
@ -668,8 +668,8 @@ TEST(proofs, g2_deserialization)
|
|||
}
|
||||
}
|
||||
|
||||
#include "json_test_vectors.h"
|
||||
#include "test/data/g1_compressed.json.h"
|
||||
#include <json_test_vectors.h>
|
||||
#include <test/data/g1_compressed.json.h>
|
||||
|
||||
TEST(proofs, g1_test_vectors)
|
||||
{
|
||||
|
@ -685,7 +685,7 @@ TEST(proofs, g1_test_vectors)
|
|||
}
|
||||
}
|
||||
|
||||
#include "test/data/g2_compressed.json.h"
|
||||
#include <test/data/g2_compressed.json.h>
|
||||
|
||||
TEST(proofs, g2_test_vectors)
|
||||
{
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include <gtest/gtest.h>
|
||||
|
||||
#include "random.h"
|
||||
#include <random.h>
|
||||
|
||||
extern int GenZero(int n);
|
||||
extern int GenMax(int n);
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
#include <gtest/gtest.h>
|
||||
#include <univalue.h>
|
||||
|
||||
#include "chain.h"
|
||||
#include "chainparams.h"
|
||||
#include "clientversion.h"
|
||||
#include "primitives/block.h"
|
||||
#include "rpcserver.h"
|
||||
#include "streams.h"
|
||||
#include "utilstrencodings.h"
|
||||
#include <chain.h>
|
||||
#include <chainparams.h>
|
||||
#include <clientversion.h>
|
||||
#include <primitives/block.h>
|
||||
#include <rpcserver.h>
|
||||
#include <streams.h>
|
||||
#include <utilstrencodings.h>
|
||||
|
||||
extern UniValue blockToJSON(const CBlock& block, const CBlockIndex* blockindex, bool txDetails = false);
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#include <gtest/gtest.h>
|
||||
|
||||
#include "primitives/transaction.h"
|
||||
#include "zcash/Note.hpp"
|
||||
#include "zcash/Address.hpp"
|
||||
#include <primitives/transaction.h>
|
||||
#include <zcash/Note.hpp>
|
||||
#include <zcash/Address.hpp>
|
||||
|
||||
extern ZCJoinSplit* params;
|
||||
extern int GenZero(int n);
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
#include <gtest/gtest.h>
|
||||
#include "primitives/transaction.h"
|
||||
#include "clientversion.h"
|
||||
#include "serialize.h"
|
||||
#include "streams.h"
|
||||
#include "uint256.h"
|
||||
#include "util.h"
|
||||
#include "utilstrencodings.h"
|
||||
#include <primitives/transaction.h>
|
||||
#include <clientversion.h>
|
||||
#include <serialize.h>
|
||||
#include <streams.h>
|
||||
#include <uint256.h>
|
||||
#include <util.h>
|
||||
#include <utilstrencodings.h>
|
||||
|
||||
/*
|
||||
Test that removing #1144 succeeded by verifying the hash of a transaction is over the entire serialized form.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include <gtest/gtest.h>
|
||||
|
||||
#include "chainparams.h"
|
||||
#include "consensus/upgrades.h"
|
||||
#include <chainparams.h>
|
||||
#include <consensus/upgrades.h>
|
||||
|
||||
#include <boost/optional.hpp>
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#include <gtest/gtest.h>
|
||||
|
||||
#include "consensus/upgrades.h"
|
||||
#include "consensus/validation.h"
|
||||
#include "main.h"
|
||||
#include "utiltest.h"
|
||||
#include <consensus/upgrades.h>
|
||||
#include <consensus/validation.h>
|
||||
#include <main.h>
|
||||
#include <utiltest.h>
|
||||
|
||||
extern ZCJoinSplit* params;
|
||||
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include "paymentdisclosure.h"
|
||||
#include "util.h"
|
||||
#include <paymentdisclosure.h>
|
||||
#include <util.h>
|
||||
|
||||
std::string PaymentDisclosureInfo::ToString() const {
|
||||
return strprintf("PaymentDisclosureInfo(version=%d, esk=%s, joinSplitPrivKey=<omitted>, address=%s)",
|
||||
|
|
|
@ -5,15 +5,15 @@
|
|||
#ifndef ZCASH_PAYMENTDISCLOSURE_H
|
||||
#define ZCASH_PAYMENTDISCLOSURE_H
|
||||
|
||||
#include "uint256.h"
|
||||
#include "clientversion.h"
|
||||
#include "serialize.h"
|
||||
#include "streams.h"
|
||||
#include "version.h"
|
||||
#include <uint256.h>
|
||||
#include <clientversion.h>
|
||||
#include <serialize.h>
|
||||
#include <streams.h>
|
||||
#include <version.h>
|
||||
|
||||
// For JSOutPoint
|
||||
#include <zkaddr.h>
|
||||
#include "wallet/wallet.h"
|
||||
#include <wallet/wallet.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
@ -114,11 +114,11 @@ struct PaymentDisclosurePayload {
|
|||
|
||||
struct PaymentDisclosure {
|
||||
PaymentDisclosurePayload payload;
|
||||
boost::array<unsigned char, 64> payloadSig;
|
||||
std::array<unsigned char, 64> payloadSig;
|
||||
// We use boost array because serialize doesn't like char buffer, otherwise we could do: unsigned char payloadSig[64];
|
||||
|
||||
PaymentDisclosure() {};
|
||||
PaymentDisclosure(const PaymentDisclosurePayload payload, const boost::array<unsigned char, 64> sig) : payload(payload), payloadSig(sig) {};
|
||||
PaymentDisclosure(const PaymentDisclosurePayload payload, const std::array<unsigned char, 64> sig) : payload(payload), payloadSig(sig) {};
|
||||
PaymentDisclosure(const uint256& joinSplitPubKey, const PaymentDisclosureKey& key, const PaymentDisclosureInfo& info, const std::string& message);
|
||||
|
||||
ADD_SERIALIZE_METHODS;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#ifndef ZCASH_PAYMENTDISCLOSUREDB_H
|
||||
#define ZCASH_PAYMENTDISCLOSUREDB_H
|
||||
|
||||
#include "paymentdisclosure.h"
|
||||
#include <paymentdisclosure.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
|
|
@ -7,17 +7,17 @@
|
|||
#ifndef BTCP_PRIMITIVES_JOINSPLIT_H
|
||||
#define BTCP_PRIMITIVES_JOINSPLIT_H
|
||||
|
||||
#include "amount.h"
|
||||
#include "random.h"
|
||||
#include "script/script.h"
|
||||
#include "serialize.h"
|
||||
#include "uint256.h"
|
||||
#include "consensus/consensus.h"
|
||||
#include <amount.h>
|
||||
#include <random.h>
|
||||
#include <script/script.h>
|
||||
#include <serialize.h>
|
||||
#include <uint256.h>
|
||||
#include <consensus/consensus.h>
|
||||
|
||||
#include "zcash/NoteEncryption.hpp"
|
||||
#include "zcash/Zcash.h"
|
||||
#include "zcash/JoinSplit.hpp"
|
||||
#include "zcash/Proof.hpp"
|
||||
#include <zcash/NoteEncryption.hpp>
|
||||
#include <zcash/Zcash.h>
|
||||
#include <zcash/JoinSplit.hpp>
|
||||
#include <zcash/Proof.hpp>
|
||||
|
||||
#include <boost/array.hpp>
|
||||
|
||||
|
|
|
@ -4,16 +4,16 @@
|
|||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
#include "config/bitcoin-config.h"
|
||||
#include <config/bitcoin-config.h>
|
||||
#endif
|
||||
|
||||
#include "arith_uint256.h"
|
||||
#include "crypto/sha256.h"
|
||||
#include "crypto/equihash.h"
|
||||
#include "test/test_bitcoin.h"
|
||||
#include "uint256.h"
|
||||
#include <arith_uint256.h>
|
||||
#include <crypto/sha256.h>
|
||||
#include <crypto/equihash.h>
|
||||
#include <test/test_bitcoin.h>
|
||||
#include <uint256.h>
|
||||
|
||||
#include "sodium.h"
|
||||
#include <sodium.h>
|
||||
|
||||
#include <sstream>
|
||||
#include <set>
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
#define UINT252_H
|
||||
|
||||
#include <vector>
|
||||
#include "uint256.h"
|
||||
#include "serialize.h"
|
||||
#include <uint256.h>
|
||||
#include <serialize.h>
|
||||
|
||||
// Wrapper of uint256 with guarantee that first
|
||||
// four bits are zero.
|
||||
|
|
|
@ -2,34 +2,34 @@
|
|||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include "asyncrpcoperation_mergetoaddress.h"
|
||||
#include <wallet/asyncrpcoperation_mergetoaddress.h>
|
||||
|
||||
#include "amount.h"
|
||||
#include "asyncrpcqueue.h"
|
||||
#include "core_io.h"
|
||||
#include "init.h"
|
||||
#include "main.h"
|
||||
#include "miner.h"
|
||||
#include "net.h"
|
||||
#include "netbase.h"
|
||||
#include "rpcprotocol.h"
|
||||
#include "rpcserver.h"
|
||||
#include "script/interpreter.h"
|
||||
#include "sodium.h"
|
||||
#include "timedata.h"
|
||||
#include "util.h"
|
||||
#include "utilmoneystr.h"
|
||||
#include "utiltime.h"
|
||||
#include "wallet.h"
|
||||
#include "walletdb.h"
|
||||
#include "zcash/IncrementalMerkleTree.hpp"
|
||||
#include <amount.h>
|
||||
#include <asyncrpcqueue.h>
|
||||
#include <core_io.h>
|
||||
#include <init.h>
|
||||
#include <validation.h>
|
||||
#include <miner.h>
|
||||
#include <net.h>
|
||||
#include <netbase.h>
|
||||
#include <rpc/protocol.h>
|
||||
#include <rpc/server.h>
|
||||
#include <script/interpreter.h>
|
||||
#include <sodium.h>
|
||||
#include <timedata.h>
|
||||
#include <util.h>
|
||||
#include <utilmoneystr.h>
|
||||
#include <utiltime.h>
|
||||
#include <wallet/wallet.h>
|
||||
#include <wallet/walletdb.h>
|
||||
#include <zcash/IncrementalMerkleTree.hpp>
|
||||
|
||||
#include <chrono>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <thread>
|
||||
|
||||
#include "paymentdisclosuredb.h"
|
||||
#include <wallet/paymentdisclosuredb.h>
|
||||
|
||||
using namespace libzcash;
|
||||
|
||||
|
@ -382,7 +382,7 @@ bool AsyncRPCOperation_mergetoaddress::main_impl()
|
|||
}
|
||||
|
||||
// Keep track of treestate within this transaction
|
||||
boost::unordered_map<uint256, ZCIncrementalMerkleTree, CCoinsKeyHasher> intermediates;
|
||||
std::unordered_map<uint256, ZCIncrementalMerkleTree, CCoinsKeyHasher> intermediates;
|
||||
std::vector<uint256> previousCommitments;
|
||||
|
||||
while (!vpubNewProcessed) {
|
||||
|
@ -757,10 +757,10 @@ UniValue AsyncRPCOperation_mergetoaddress::perform_joinsplit(
|
|||
FormatMoney(info.vjsout[0].value), FormatMoney(info.vjsout[1].value));
|
||||
|
||||
// Generate the proof, this can take over a minute.
|
||||
boost::array<libzcash::JSInput, ZC_NUM_JS_INPUTS> inputs{info.vjsin[0], info.vjsin[1]};
|
||||
boost::array<libzcash::JSOutput, ZC_NUM_JS_OUTPUTS> outputs{info.vjsout[0], info.vjsout[1]};
|
||||
boost::array<size_t, ZC_NUM_JS_INPUTS> inputMap;
|
||||
boost::array<size_t, ZC_NUM_JS_OUTPUTS> outputMap;
|
||||
std::array<libzcash::JSInput, ZC_NUM_JS_INPUTS> inputs{info.vjsin[0], info.vjsin[1]};
|
||||
std::array<libzcash::JSOutput, ZC_NUM_JS_OUTPUTS> outputs{info.vjsout[0], info.vjsout[1]};
|
||||
std::array<size_t, ZC_NUM_JS_INPUTS> inputMap;
|
||||
std::array<size_t, ZC_NUM_JS_OUTPUTS> outputMap;
|
||||
|
||||
uint256 esk; // payment disclosure - secret
|
||||
|
||||
|
@ -871,9 +871,9 @@ UniValue AsyncRPCOperation_mergetoaddress::perform_joinsplit(
|
|||
return obj;
|
||||
}
|
||||
|
||||
boost::array<unsigned char, ZC_MEMO_SIZE> AsyncRPCOperation_mergetoaddress::get_memo_from_hex_string(std::string s)
|
||||
std::array<unsigned char, ZC_MEMO_SIZE> AsyncRPCOperation_mergetoaddress::get_memo_from_hex_string(std::string s)
|
||||
{
|
||||
boost::array<unsigned char, ZC_MEMO_SIZE> memo = {{0x00}};
|
||||
std::array<unsigned char, ZC_MEMO_SIZE> memo = {{0x00}};
|
||||
|
||||
std::vector<unsigned char> rawMemo = ParseHex(s.c_str());
|
||||
|
||||
|
|
|
@ -5,14 +5,14 @@
|
|||
#ifndef ASYNCRPCOPERATION_MERGETOADDRESS_H
|
||||
#define ASYNCRPCOPERATION_MERGETOADDRESS_H
|
||||
|
||||
#include "amount.h"
|
||||
#include "asyncrpcoperation.h"
|
||||
#include "base58.h"
|
||||
#include "paymentdisclosure.h"
|
||||
#include "primitives/transaction.h"
|
||||
#include "wallet.h"
|
||||
#include "zcash/Address.hpp"
|
||||
#include "zcash/JoinSplit.hpp"
|
||||
#include <amount.h>
|
||||
#include <asyncrpcoperation.h>
|
||||
#include <base58.h>
|
||||
#include <paymentdisclosure.h>
|
||||
#include <primitives/transaction.h>
|
||||
#include <wallet/wallet.h>
|
||||
#include <zcash/Address.hpp>
|
||||
#include <zcash/JoinSplit.hpp>
|
||||
|
||||
#include <tuple>
|
||||
#include <unordered_map>
|
||||
|
@ -100,7 +100,7 @@ private:
|
|||
|
||||
CTransaction tx_;
|
||||
|
||||
boost::array<unsigned char, ZC_MEMO_SIZE> get_memo_from_hex_string(std::string s);
|
||||
std::array<unsigned char, ZC_MEMO_SIZE> get_memo_from_hex_string(std::string s);
|
||||
bool main_impl();
|
||||
|
||||
// JoinSplit without any input notes to spend
|
||||
|
@ -150,7 +150,7 @@ public:
|
|||
|
||||
// Delegated methods
|
||||
|
||||
boost::array<unsigned char, ZC_MEMO_SIZE> get_memo_from_hex_string(std::string s)
|
||||
std::array<unsigned char, ZC_MEMO_SIZE> get_memo_from_hex_string(std::string s)
|
||||
{
|
||||
return delegate->get_memo_from_hex_string(s);
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#include <thread>
|
||||
#include <string>
|
||||
|
||||
#include "paymentdisclosuredb.h"
|
||||
#include <wallet/paymentdisclosuredb.h>
|
||||
|
||||
using namespace libzcash;
|
||||
|
||||
|
@ -509,7 +509,7 @@ bool AsyncRPCOperation_sendmany::main_impl() {
|
|||
}
|
||||
|
||||
// Keep track of treestate within this transaction
|
||||
boost::unordered_map<uint256, ZCIncrementalMerkleTree, CCoinsKeyHasher> intermediates;
|
||||
std::unordered_map<uint256, ZCIncrementalMerkleTree, CCoinsKeyHasher> intermediates;
|
||||
std::vector<uint256> previousCommitments;
|
||||
|
||||
while (!vpubNewProcessed) {
|
||||
|
@ -973,12 +973,12 @@ UniValue AsyncRPCOperation_sendmany::perform_joinsplit(
|
|||
);
|
||||
|
||||
// Generate the proof, this can take over a minute.
|
||||
boost::array<libzcash::JSInput, ZC_NUM_JS_INPUTS> inputs
|
||||
std::array<libzcash::JSInput, ZC_NUM_JS_INPUTS> inputs
|
||||
{info.vjsin[0], info.vjsin[1]};
|
||||
boost::array<libzcash::JSOutput, ZC_NUM_JS_OUTPUTS> outputs
|
||||
std::array<libzcash::JSOutput, ZC_NUM_JS_OUTPUTS> outputs
|
||||
{info.vjsout[0], info.vjsout[1]};
|
||||
boost::array<size_t, ZC_NUM_JS_INPUTS> inputMap;
|
||||
boost::array<size_t, ZC_NUM_JS_OUTPUTS> outputMap;
|
||||
std::array<size_t, ZC_NUM_JS_INPUTS> inputMap;
|
||||
std::array<size_t, ZC_NUM_JS_OUTPUTS> outputMap;
|
||||
|
||||
uint256 esk; // payment disclosure - secret
|
||||
|
||||
|
@ -1134,8 +1134,8 @@ void AsyncRPCOperation_sendmany::add_taddr_change_output_to_tx(CAmount amount) {
|
|||
tx_ = CTransaction(rawTx);
|
||||
}
|
||||
|
||||
boost::array<unsigned char, ZC_MEMO_SIZE> AsyncRPCOperation_sendmany::get_memo_from_hex_string(std::string s) {
|
||||
boost::array<unsigned char, ZC_MEMO_SIZE> memo = {{0x00}};
|
||||
std::array<unsigned char, ZC_MEMO_SIZE> AsyncRPCOperation_sendmany::get_memo_from_hex_string(std::string s) {
|
||||
std::array<unsigned char, ZC_MEMO_SIZE> memo = {{0x00}};
|
||||
|
||||
std::vector<unsigned char> rawMemo = ParseHex(s.c_str());
|
||||
|
||||
|
|
|
@ -5,14 +5,14 @@
|
|||
#ifndef ASYNCRPCOPERATION_SENDMANY_H
|
||||
#define ASYNCRPCOPERATION_SENDMANY_H
|
||||
|
||||
#include "asyncrpcoperation.h"
|
||||
#include "amount.h"
|
||||
#include "base58.h"
|
||||
#include "primitives/transaction.h"
|
||||
#include "zcash/JoinSplit.hpp"
|
||||
#include "zcash/Address.hpp"
|
||||
#include "wallet.h"
|
||||
#include "paymentdisclosure.h"
|
||||
#include <asyncrpcoperation.h>
|
||||
#include <amount.h>
|
||||
#include <base58.h>
|
||||
#include <primitives/transaction.h>
|
||||
#include <zcash/JoinSplit.hpp>
|
||||
#include <zcash/Address.hpp>
|
||||
#include <wallet.h>
|
||||
#include <paymentdisclosure.h>
|
||||
|
||||
#include <unordered_map>
|
||||
#include <tuple>
|
||||
|
@ -53,13 +53,13 @@ class AsyncRPCOperation_sendmany : public AsyncRPCOperation {
|
|||
public:
|
||||
AsyncRPCOperation_sendmany(CMutableTransaction contextualTx, std::string fromAddress, std::vector<SendManyRecipient> tOutputs, std::vector<SendManyRecipient> zOutputs, int minDepth, CAmount fee = ASYNC_RPC_OPERATION_DEFAULT_MINERS_FEE, UniValue contextInfo = NullUniValue);
|
||||
virtual ~AsyncRPCOperation_sendmany();
|
||||
|
||||
|
||||
// We don't want to be copied or moved around
|
||||
AsyncRPCOperation_sendmany(AsyncRPCOperation_sendmany const&) = delete; // Copy construct
|
||||
AsyncRPCOperation_sendmany(AsyncRPCOperation_sendmany&&) = delete; // Move construct
|
||||
AsyncRPCOperation_sendmany& operator=(AsyncRPCOperation_sendmany const&) = delete; // Copy assign
|
||||
AsyncRPCOperation_sendmany& operator=(AsyncRPCOperation_sendmany &&) = delete; // Move assign
|
||||
|
||||
|
||||
virtual void main();
|
||||
|
||||
virtual UniValue getStatus() const;
|
||||
|
@ -82,7 +82,7 @@ private:
|
|||
CBitcoinAddress fromtaddr_;
|
||||
PaymentAddress frompaymentaddress_;
|
||||
SpendingKey spendingkey_;
|
||||
|
||||
|
||||
uint256 joinSplitPubKey_;
|
||||
unsigned char joinSplitPrivKey_[crypto_sign_SECRETKEYBYTES];
|
||||
|
||||
|
@ -93,14 +93,14 @@ private:
|
|||
std::vector<SendManyRecipient> z_outputs_;
|
||||
std::vector<SendManyInputUTXO> t_inputs_;
|
||||
std::vector<SendManyInputJSOP> z_inputs_;
|
||||
|
||||
|
||||
CTransaction tx_;
|
||||
|
||||
|
||||
void add_taddr_change_output_to_tx(CAmount amount);
|
||||
void add_taddr_outputs_to_tx();
|
||||
bool find_unspent_notes();
|
||||
bool find_utxos(bool fAcceptCoinbase);
|
||||
boost::array<unsigned char, ZC_MEMO_SIZE> get_memo_from_hex_string(std::string s);
|
||||
std::array<unsigned char, ZC_MEMO_SIZE> get_memo_from_hex_string(std::string s);
|
||||
bool main_impl();
|
||||
|
||||
// JoinSplit without any input notes to spend
|
||||
|
@ -126,27 +126,27 @@ private:
|
|||
class TEST_FRIEND_AsyncRPCOperation_sendmany {
|
||||
public:
|
||||
std::shared_ptr<AsyncRPCOperation_sendmany> delegate;
|
||||
|
||||
|
||||
TEST_FRIEND_AsyncRPCOperation_sendmany(std::shared_ptr<AsyncRPCOperation_sendmany> ptr) : delegate(ptr) {}
|
||||
|
||||
|
||||
CTransaction getTx() {
|
||||
return delegate->tx_;
|
||||
}
|
||||
|
||||
|
||||
void setTx(CTransaction tx) {
|
||||
delegate->tx_ = tx;
|
||||
}
|
||||
|
||||
|
||||
// Delegated methods
|
||||
|
||||
|
||||
void add_taddr_change_output_to_tx(CAmount amount) {
|
||||
delegate->add_taddr_change_output_to_tx(amount);
|
||||
}
|
||||
|
||||
|
||||
void add_taddr_outputs_to_tx() {
|
||||
delegate->add_taddr_outputs_to_tx();
|
||||
}
|
||||
|
||||
|
||||
bool find_unspent_notes() {
|
||||
return delegate->find_unspent_notes();
|
||||
}
|
||||
|
@ -154,11 +154,11 @@ public:
|
|||
bool find_utxos(bool fAcceptCoinbase) {
|
||||
return delegate->find_utxos(fAcceptCoinbase);
|
||||
}
|
||||
|
||||
boost::array<unsigned char, ZC_MEMO_SIZE> get_memo_from_hex_string(std::string s) {
|
||||
|
||||
std::array<unsigned char, ZC_MEMO_SIZE> get_memo_from_hex_string(std::string s) {
|
||||
return delegate->get_memo_from_hex_string(s);
|
||||
}
|
||||
|
||||
|
||||
bool main_impl() {
|
||||
return delegate->main_impl();
|
||||
}
|
||||
|
@ -182,7 +182,7 @@ public:
|
|||
void sign_send_raw_transaction(UniValue obj) {
|
||||
delegate->sign_send_raw_transaction(obj);
|
||||
}
|
||||
|
||||
|
||||
void set_state(OperationStatus state) {
|
||||
delegate->state_.store(state);
|
||||
}
|
||||
|
@ -190,4 +190,3 @@ public:
|
|||
|
||||
|
||||
#endif /* ASYNCRPCOPERATION_SENDMANY_H */
|
||||
|
||||
|
|
|
@ -28,10 +28,10 @@
|
|||
#include <thread>
|
||||
#include <string>
|
||||
|
||||
#include "asyncrpcoperation_shieldcoinbase.h"
|
||||
#include <wallet/asyncrpcoperation_shieldcoinbase.h>
|
||||
|
||||
#include "paymentdisclosure.h"
|
||||
#include "paymentdisclosuredb.h"
|
||||
#include <wallet/paymentdisclosure.h>
|
||||
#include <wallet/paymentdisclosuredb.h>
|
||||
|
||||
using namespace libzcash;
|
||||
|
||||
|
@ -346,12 +346,12 @@ UniValue AsyncRPCOperation_shieldcoinbase::perform_joinsplit(ShieldCoinbaseJSInf
|
|||
);
|
||||
|
||||
// Generate the proof, this can take over a minute.
|
||||
boost::array<libzcash::JSInput, ZC_NUM_JS_INPUTS> inputs
|
||||
std::array<libzcash::JSInput, ZC_NUM_JS_INPUTS> inputs
|
||||
{info.vjsin[0], info.vjsin[1]};
|
||||
boost::array<libzcash::JSOutput, ZC_NUM_JS_OUTPUTS> outputs
|
||||
std::array<libzcash::JSOutput, ZC_NUM_JS_OUTPUTS> outputs
|
||||
{info.vjsout[0], info.vjsout[1]};
|
||||
boost::array<size_t, ZC_NUM_JS_INPUTS> inputMap;
|
||||
boost::array<size_t, ZC_NUM_JS_OUTPUTS> outputMap;
|
||||
std::array<size_t, ZC_NUM_JS_INPUTS> inputMap;
|
||||
std::array<size_t, ZC_NUM_JS_OUTPUTS> outputMap;
|
||||
|
||||
uint256 esk; // payment disclosure - secret
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
#include <univalue.h>
|
||||
|
||||
#include "paymentdisclosure.h"
|
||||
#include <wallet/paymentdisclosure.h>
|
||||
|
||||
// Default transaction fee if caller does not specify one.
|
||||
#define SHIELD_COINBASE_DEFAULT_MINERS_FEE 10000
|
||||
|
|
|
@ -2,14 +2,14 @@
|
|||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include "wallet/wallet.h"
|
||||
#include "wallet/coinselection.h"
|
||||
#include "wallet/coincontrol.h"
|
||||
#include "amount.h"
|
||||
#include "primitives/transaction.h"
|
||||
#include "random.h"
|
||||
#include "test/test_bitcoin.h"
|
||||
#include "wallet/test/wallet_test_fixture.h"
|
||||
#include <wallet/wallet.h>
|
||||
#include <wallet/coinselection.h>
|
||||
#include <wallet/coincontrol.h>
|
||||
#include <amount.h>
|
||||
#include <primitives/transaction.h>
|
||||
#include <random.h>
|
||||
#include <test/test_bitcoin.h>
|
||||
#include <wallet/test/wallet_test_fixture.h>
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include <random>
|
||||
|
|
|
@ -47,7 +47,7 @@ public:
|
|||
friend bool operator==(const EmptyMerkleRoots<D, H>& a,
|
||||
const EmptyMerkleRoots<D, H>& b);
|
||||
private:
|
||||
boost::array<Hash, Depth+1> empty_roots;
|
||||
std::array<Hash, Depth+1> empty_roots;
|
||||
};
|
||||
|
||||
template<size_t Depth, typename Hash>
|
||||
|
|
|
@ -103,9 +103,9 @@ public:
|
|||
ProofVerifier& verifier,
|
||||
const uint256& pubKeyHash,
|
||||
const uint256& randomSeed,
|
||||
const boost::array<uint256, NumInputs>& macs,
|
||||
const boost::array<uint256, NumInputs>& nullifiers,
|
||||
const boost::array<uint256, NumOutputs>& commitments,
|
||||
const std::array<uint256, NumInputs>& macs,
|
||||
const std::array<uint256, NumInputs>& nullifiers,
|
||||
const std::array<uint256, NumOutputs>& commitments,
|
||||
uint64_t vpub_old,
|
||||
uint64_t vpub_new,
|
||||
const uint256& rt
|
||||
|
@ -137,16 +137,16 @@ public:
|
|||
}
|
||||
|
||||
ZCProof prove(
|
||||
const boost::array<JSInput, NumInputs>& inputs,
|
||||
const boost::array<JSOutput, NumOutputs>& outputs,
|
||||
boost::array<Note, NumOutputs>& out_notes,
|
||||
boost::array<ZCNoteEncryption::Ciphertext, NumOutputs>& out_ciphertexts,
|
||||
const std::array<JSInput, NumInputs>& inputs,
|
||||
const std::array<JSOutput, NumOutputs>& outputs,
|
||||
std::array<Note, NumOutputs>& out_notes,
|
||||
std::array<ZCNoteEncryption::Ciphertext, NumOutputs>& out_ciphertexts,
|
||||
uint256& out_ephemeralKey,
|
||||
const uint256& pubKeyHash,
|
||||
uint256& out_randomSeed,
|
||||
boost::array<uint256, NumInputs>& out_macs,
|
||||
boost::array<uint256, NumInputs>& out_nullifiers,
|
||||
boost::array<uint256, NumOutputs>& out_commitments,
|
||||
std::array<uint256, NumInputs>& out_macs,
|
||||
std::array<uint256, NumInputs>& out_nullifiers,
|
||||
std::array<uint256, NumOutputs>& out_commitments,
|
||||
uint64_t vpub_old,
|
||||
uint64_t vpub_new,
|
||||
const uint256& rt,
|
||||
|
@ -335,7 +335,7 @@ JoinSplit<NumInputs, NumOutputs>* JoinSplit<NumInputs, NumOutputs>::Prepared(con
|
|||
template<size_t NumInputs, size_t NumOutputs>
|
||||
uint256 JoinSplit<NumInputs, NumOutputs>::h_sig(
|
||||
const uint256& randomSeed,
|
||||
const boost::array<uint256, NumInputs>& nullifiers,
|
||||
const std::array<uint256, NumInputs>& nullifiers,
|
||||
const uint256& pubKeyHash
|
||||
) {
|
||||
const unsigned char personalization[crypto_generichash_blake2b_PERSONALBYTES]
|
||||
|
|
|
@ -35,7 +35,7 @@ class JSOutput {
|
|||
public:
|
||||
PaymentAddress addr;
|
||||
uint64_t value;
|
||||
boost::array<unsigned char, ZC_MEMO_SIZE> memo = {{0xF6}}; // 0xF6 is invalid UTF8 as per spec, rest of array is 0x00
|
||||
std::array<unsigned char, ZC_MEMO_SIZE> memo = {{0xF6}}; // 0xF6 is invalid UTF8 as per spec, rest of array is 0x00
|
||||
|
||||
JSOutput();
|
||||
JSOutput(PaymentAddress addr, uint64_t value) : addr(addr), value(value) { }
|
||||
|
@ -55,21 +55,21 @@ public:
|
|||
const std::string pkPath);
|
||||
|
||||
static uint256 h_sig(const uint256& randomSeed,
|
||||
const boost::array<uint256, NumInputs>& nullifiers,
|
||||
const std::array<uint256, NumInputs>& nullifiers,
|
||||
const uint256& pubKeyHash
|
||||
);
|
||||
|
||||
virtual ZCProof prove(
|
||||
const boost::array<JSInput, NumInputs>& inputs,
|
||||
const boost::array<JSOutput, NumOutputs>& outputs,
|
||||
boost::array<Note, NumOutputs>& out_notes,
|
||||
boost::array<ZCNoteEncryption::Ciphertext, NumOutputs>& out_ciphertexts,
|
||||
const std::array<JSInput, NumInputs>& inputs,
|
||||
const std::array<JSOutput, NumOutputs>& outputs,
|
||||
std::array<Note, NumOutputs>& out_notes,
|
||||
std::array<ZCNoteEncryption::Ciphertext, NumOutputs>& out_ciphertexts,
|
||||
uint256& out_ephemeralKey,
|
||||
const uint256& pubKeyHash,
|
||||
uint256& out_randomSeed,
|
||||
boost::array<uint256, NumInputs>& out_hmacs,
|
||||
boost::array<uint256, NumInputs>& out_nullifiers,
|
||||
boost::array<uint256, NumOutputs>& out_commitments,
|
||||
std::array<uint256, NumInputs>& out_hmacs,
|
||||
std::array<uint256, NumInputs>& out_nullifiers,
|
||||
std::array<uint256, NumOutputs>& out_commitments,
|
||||
uint64_t vpub_old,
|
||||
uint64_t vpub_new,
|
||||
const uint256& rt,
|
||||
|
@ -85,9 +85,9 @@ public:
|
|||
ProofVerifier& verifier,
|
||||
const uint256& pubKeyHash,
|
||||
const uint256& randomSeed,
|
||||
const boost::array<uint256, NumInputs>& hmacs,
|
||||
const boost::array<uint256, NumInputs>& nullifiers,
|
||||
const boost::array<uint256, NumOutputs>& commitments,
|
||||
const std::array<uint256, NumInputs>& hmacs,
|
||||
const std::array<uint256, NumInputs>& nullifiers,
|
||||
const std::array<uint256, NumOutputs>& commitments,
|
||||
uint64_t vpub_old,
|
||||
uint64_t vpub_new,
|
||||
const uint256& rt
|
||||
|
|
|
@ -41,7 +41,7 @@ uint256 Note::nullifier(const SpendingKey& a_sk) const {
|
|||
|
||||
NotePlaintext::NotePlaintext(
|
||||
const Note& note,
|
||||
boost::array<unsigned char, ZC_MEMO_SIZE> memo) : memo(memo)
|
||||
std::array<unsigned char, ZC_MEMO_SIZE> memo) : memo(memo)
|
||||
{
|
||||
value = note.value;
|
||||
rho = note.rho;
|
||||
|
|
|
@ -29,11 +29,11 @@ public:
|
|||
uint64_t value = 0;
|
||||
uint256 rho;
|
||||
uint256 r;
|
||||
boost::array<unsigned char, ZC_MEMO_SIZE> memo;
|
||||
std::array<unsigned char, ZC_MEMO_SIZE> memo;
|
||||
|
||||
NotePlaintext() {}
|
||||
|
||||
NotePlaintext(const Note& note, boost::array<unsigned char, ZC_MEMO_SIZE> memo);
|
||||
NotePlaintext(const Note& note, std::array<unsigned char, ZC_MEMO_SIZE> memo);
|
||||
|
||||
Note note(const PaymentAddress& addr) const;
|
||||
|
||||
|
|
|
@ -26,8 +26,8 @@ protected:
|
|||
uint256 hSig;
|
||||
|
||||
public:
|
||||
typedef boost::array<unsigned char, CLEN> Ciphertext;
|
||||
typedef boost::array<unsigned char, MLEN> Plaintext;
|
||||
typedef std::array<unsigned char, CLEN> Ciphertext;
|
||||
typedef std::array<unsigned char, MLEN> Plaintext;
|
||||
|
||||
NoteEncryption(uint256 hSig);
|
||||
|
||||
|
@ -63,8 +63,8 @@ protected:
|
|||
uint256 pk_enc;
|
||||
|
||||
public:
|
||||
typedef boost::array<unsigned char, CLEN> Ciphertext;
|
||||
typedef boost::array<unsigned char, MLEN> Plaintext;
|
||||
typedef std::array<unsigned char, CLEN> Ciphertext;
|
||||
typedef std::array<unsigned char, MLEN> Plaintext;
|
||||
|
||||
NoteDecryption() { }
|
||||
NoteDecryption(uint256 sk_enc);
|
||||
|
@ -100,8 +100,8 @@ class PaymentDisclosureNoteDecryption : public NoteDecryption<MLEN> {
|
|||
protected:
|
||||
public:
|
||||
enum { CLEN=MLEN+NOTEENCRYPTION_AUTH_BYTES };
|
||||
typedef boost::array<unsigned char, CLEN> Ciphertext;
|
||||
typedef boost::array<unsigned char, MLEN> Plaintext;
|
||||
typedef std::array<unsigned char, CLEN> Ciphertext;
|
||||
typedef std::array<unsigned char, MLEN> Plaintext;
|
||||
|
||||
PaymentDisclosureNoteDecryption() : NoteDecryption<MLEN>() {}
|
||||
PaymentDisclosureNoteDecryption(uint256 sk_enc) : NoteDecryption<MLEN>(sk_enc) {}
|
||||
|
|
|
@ -14,9 +14,9 @@ private:
|
|||
|
||||
std::shared_ptr<digest_variable<FieldT>> zk_merkle_root;
|
||||
std::shared_ptr<digest_variable<FieldT>> zk_h_sig;
|
||||
boost::array<std::shared_ptr<digest_variable<FieldT>>, NumInputs> zk_input_nullifiers;
|
||||
boost::array<std::shared_ptr<digest_variable<FieldT>>, NumInputs> zk_input_macs;
|
||||
boost::array<std::shared_ptr<digest_variable<FieldT>>, NumOutputs> zk_output_commitments;
|
||||
std::array<std::shared_ptr<digest_variable<FieldT>>, NumInputs> zk_input_nullifiers;
|
||||
std::array<std::shared_ptr<digest_variable<FieldT>>, NumInputs> zk_input_macs;
|
||||
std::array<std::shared_ptr<digest_variable<FieldT>>, NumOutputs> zk_output_commitments;
|
||||
pb_variable_array<FieldT> zk_vpub_old;
|
||||
pb_variable_array<FieldT> zk_vpub_new;
|
||||
|
||||
|
@ -26,11 +26,11 @@ private:
|
|||
pb_variable_array<FieldT> zk_total_uint64;
|
||||
|
||||
// Input note gadgets
|
||||
boost::array<std::shared_ptr<input_note_gadget<FieldT>>, NumInputs> zk_input_notes;
|
||||
boost::array<std::shared_ptr<PRF_pk_gadget<FieldT>>, NumInputs> zk_mac_authentication;
|
||||
std::array<std::shared_ptr<input_note_gadget<FieldT>>, NumInputs> zk_input_notes;
|
||||
std::array<std::shared_ptr<PRF_pk_gadget<FieldT>>, NumInputs> zk_mac_authentication;
|
||||
|
||||
// Output note gadgets
|
||||
boost::array<std::shared_ptr<output_note_gadget<FieldT>>, NumOutputs> zk_output_notes;
|
||||
std::array<std::shared_ptr<output_note_gadget<FieldT>>, NumOutputs> zk_output_notes;
|
||||
|
||||
public:
|
||||
// PRF_pk only has a 1-bit domain separation "nonce"
|
||||
|
@ -190,8 +190,8 @@ public:
|
|||
const uint252& phi,
|
||||
const uint256& rt,
|
||||
const uint256& h_sig,
|
||||
const boost::array<JSInput, NumInputs>& inputs,
|
||||
const boost::array<Note, NumOutputs>& outputs,
|
||||
const std::array<JSInput, NumInputs>& inputs,
|
||||
const std::array<Note, NumOutputs>& outputs,
|
||||
uint64_t vpub_old,
|
||||
uint64_t vpub_new
|
||||
) {
|
||||
|
@ -280,9 +280,9 @@ public:
|
|||
static r1cs_primary_input<FieldT> witness_map(
|
||||
const uint256& rt,
|
||||
const uint256& h_sig,
|
||||
const boost::array<uint256, NumInputs>& macs,
|
||||
const boost::array<uint256, NumInputs>& nullifiers,
|
||||
const boost::array<uint256, NumOutputs>& commitments,
|
||||
const std::array<uint256, NumInputs>& macs,
|
||||
const std::array<uint256, NumInputs>& nullifiers,
|
||||
const std::array<uint256, NumOutputs>& commitments,
|
||||
uint64_t vpub_old,
|
||||
uint64_t vpub_new
|
||||
) {
|
||||
|
|
Loading…
Reference in New Issue