mirror of
https://github.com/dashpay/dash.git
synced 2024-12-24 19:42:46 +01:00
Merge pull request #3882 from PastaPastaPasta/backports-0.17-pr25
Backports 0.17 pr25
This commit is contained in:
commit
1c8f475a7f
@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
# use testnet settings, if you need mainnet, use ~/.dashcore/dashd.pid file instead
|
||||
export LC_ALL=C
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
export LC_ALL=C
|
||||
TOPDIR=${TOPDIR:-$(git rev-parse --show-toplevel)}
|
||||
|
@ -81,7 +81,7 @@ script: |
|
||||
|
||||
function create_global_faketime_wrappers {
|
||||
for prog in ${FAKETIME_PROGS}; do
|
||||
echo '#!/bin/bash' > ${WRAP_DIR}/${prog}
|
||||
echo '#!/usr/bin/env bash' > ${WRAP_DIR}/${prog}
|
||||
echo "# GCCVERSION=${GCCVERSION}" >> ${WRAP_DIR}/${prog}
|
||||
echo "REAL=\`which -a ${prog} | grep -v ${WRAP_DIR}/${prog} | head -1\`" >> ${WRAP_DIR}/${prog}
|
||||
echo 'export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1' >> ${WRAP_DIR}/${prog}
|
||||
@ -95,7 +95,7 @@ script: |
|
||||
function create_per-host_faketime_wrappers {
|
||||
for i in $HOSTS; do
|
||||
for prog in ${FAKETIME_HOST_PROGS}; do
|
||||
echo '#!/bin/bash' > ${WRAP_DIR}/${i}-${prog}
|
||||
echo '#!/usr/bin/env bash' > ${WRAP_DIR}/${i}-${prog}
|
||||
echo "# GCCVERSION=${GCCVERSION}" >> ${WRAP_DIR}/${i}-${prog}
|
||||
echo "REAL=\`which -a ${i}-${prog} | grep -v ${WRAP_DIR}/${i}-${prog} | head -1\`" >> ${WRAP_DIR}/${i}-${prog}
|
||||
echo 'export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1' >> ${WRAP_DIR}/${i}-${prog}
|
||||
@ -127,7 +127,7 @@ script: |
|
||||
for prog in gcc g++; do
|
||||
rm -f ${WRAP_DIR}/${prog}
|
||||
cat << EOF > ${WRAP_DIR}/${prog}
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
# GCCVERSION=${GCCVERSION}
|
||||
REAL="`which -a ${prog} | grep -v ${WRAP_DIR}/${prog} | head -1`"
|
||||
for var in "\$@"
|
||||
|
@ -19,7 +19,7 @@ script: |
|
||||
|
||||
# Create global faketime wrappers
|
||||
for prog in ${FAKETIME_PROGS}; do
|
||||
echo '#!/bin/bash' > ${WRAP_DIR}/${prog}
|
||||
echo '#!/usr/bin/env bash' > ${WRAP_DIR}/${prog}
|
||||
echo "REAL=\`which -a ${prog} | grep -v ${WRAP_DIR}/${prog} | head -1\`" >> ${WRAP_DIR}/${prog}
|
||||
echo 'export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1' >> ${WRAP_DIR}/${prog}
|
||||
echo "export FAKETIME=\"${REFERENCE_DATETIME}\"" >> ${WRAP_DIR}/${prog}
|
||||
|
@ -74,7 +74,7 @@ script: |
|
||||
|
||||
function create_global_faketime_wrappers {
|
||||
for prog in ${FAKETIME_PROGS}; do
|
||||
echo '#!/bin/bash' > ${WRAP_DIR}/${prog}
|
||||
echo '#!/usr/bin/env bash' > ${WRAP_DIR}/${prog}
|
||||
echo "REAL=\`which -a ${prog} | grep -v ${WRAP_DIR}/${prog} | head -1\`" >> ${WRAP_DIR}/${prog}
|
||||
echo 'export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1' >> ${WRAP_DIR}/${prog}
|
||||
echo "export FAKETIME=\"$1\"" >> ${WRAP_DIR}/${prog}
|
||||
@ -87,7 +87,7 @@ script: |
|
||||
function create_per-host_faketime_wrappers {
|
||||
for i in $HOSTS; do
|
||||
for prog in ${FAKETIME_HOST_PROGS}; do
|
||||
echo '#!/bin/bash' > ${WRAP_DIR}/${i}-${prog}
|
||||
echo '#!/usr/bin/env bash' > ${WRAP_DIR}/${i}-${prog}
|
||||
echo "REAL=\`which -a ${i}-${prog} | grep -v ${WRAP_DIR}/${i}-${prog} | head -1\`" >> ${WRAP_DIR}/${i}-${prog}
|
||||
echo 'export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1' >> ${WRAP_DIR}/${i}-${prog}
|
||||
echo "export FAKETIME=\"$1\"" >> ${WRAP_DIR}/${i}-${prog}
|
||||
|
@ -73,7 +73,7 @@ script: |
|
||||
|
||||
function create_global_faketime_wrappers {
|
||||
for prog in ${FAKETIME_PROGS}; do
|
||||
echo '#!/bin/bash' > ${WRAP_DIR}/${prog}
|
||||
echo '#!/usr/bin/env bash' > ${WRAP_DIR}/${prog}
|
||||
echo "# GCCVERSION=${GCCVERSION}" >> ${WRAP_DIR}/${prog}
|
||||
echo "REAL=\`which -a ${prog} | grep -v ${WRAP_DIR}/${prog} | head -1\`" >> ${WRAP_DIR}/${prog}
|
||||
echo 'export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1' >> ${WRAP_DIR}/${prog}
|
||||
@ -87,7 +87,7 @@ script: |
|
||||
function create_per-host_faketime_wrappers {
|
||||
for i in $HOSTS; do
|
||||
for prog in ${FAKETIME_HOST_PROGS}; do
|
||||
echo '#!/bin/bash' > ${WRAP_DIR}/${i}-${prog}
|
||||
echo '#!/usr/bin/env bash' > ${WRAP_DIR}/${i}-${prog}
|
||||
echo "# GCCVERSION=${GCCVERSION}" >> ${WRAP_DIR}/${i}-${prog}
|
||||
echo "REAL=\`which -a ${i}-${prog} | grep -v ${WRAP_DIR}/${i}-${prog} | head -1\`" >> ${WRAP_DIR}/${i}-${prog}
|
||||
echo 'export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1' >> ${WRAP_DIR}/${i}-${prog}
|
||||
@ -105,7 +105,7 @@ script: |
|
||||
for i in $HOSTS; do
|
||||
mkdir -p ${WRAP_DIR}/${i}
|
||||
for prog in collect2; do
|
||||
echo '#!/bin/bash' > ${WRAP_DIR}/${i}/${prog}
|
||||
echo '#!/usr/bin/env bash' > ${WRAP_DIR}/${i}/${prog}
|
||||
echo "# GCCVERSION=${GCCVERSION}" >> ${WRAP_DIR}/${i}/${prog}
|
||||
REAL=$(${i}-gcc -print-prog-name=${prog})
|
||||
echo "export MALLOC_PERTURB_=255" >> ${WRAP_DIR}/${i}/${prog}
|
||||
@ -114,7 +114,7 @@ script: |
|
||||
touch -d "${REFERENCE_DATETIME}" ${WRAP_DIR}/${i}/${prog}
|
||||
done
|
||||
for prog in gcc g++; do
|
||||
echo '#!/bin/bash' > ${WRAP_DIR}/${i}-${prog}
|
||||
echo '#!/usr/bin/env bash' > ${WRAP_DIR}/${i}-${prog}
|
||||
echo "# GCCVERSION=${GCCVERSION}" >> ${WRAP_DIR}/${i}-${prog}
|
||||
echo "REAL=\`which -a ${i}-${prog}-posix | grep -v ${WRAP_DIR}/${i}-${prog} | head -1\`" >> ${WRAP_DIR}/${i}-${prog}
|
||||
echo '# Add the gcc version to the wrapper so that ccache takes this into account (we use CCACHE_COMPILERCHECK=content)' >> ${WRAP_DIR}/${i}-${prog}
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# dashd The Dash Core server.
|
||||
#
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
# Copyright (c) 2016 The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
# Copyright (c) 2014-2015 The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
# Copyright (c) 2016 The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
@ -29,8 +29,15 @@ void InitBLSTests();
|
||||
void CleanupBLSTests();
|
||||
void CleanupBLSDkgTests();
|
||||
|
||||
int
|
||||
main(int argc, char** argv)
|
||||
static fs::path SetDataDir()
|
||||
{
|
||||
fs::path ret = fs::temp_directory_path() / "bench_dash" / fs::unique_path();
|
||||
fs::create_directories(ret);
|
||||
gArgs.ForceSetArg("-datadir", ret.string());
|
||||
return ret;
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
gArgs.ParseParameters(argc, argv);
|
||||
|
||||
@ -49,6 +56,9 @@ main(int argc, char** argv)
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Set the datadir after parsing the bench options
|
||||
const fs::path bench_datadir{SetDataDir()};
|
||||
|
||||
SHA256AutoDetect();
|
||||
|
||||
RegisterPrettySignalHandlers();
|
||||
@ -82,6 +92,8 @@ main(int argc, char** argv)
|
||||
|
||||
benchmark::BenchRunner::RunAll(*printer, evaluations, scaling_factor, regex_filter, is_list_only);
|
||||
|
||||
fs::remove_all(bench_datadir);
|
||||
|
||||
// need to be called before global destructors kick in (PoolAllocator is needed due to many BLSSecretKeys)
|
||||
CleanupBLSDkgTests();
|
||||
CleanupBLSTests();
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2009-2015 The Bitcoin Core developers
|
||||
// Copyright (c) 2009-2018 The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
@ -190,18 +190,18 @@ static CAmount ExtractAndValidateValue(const std::string& strValue)
|
||||
|
||||
static void MutateTxVersion(CMutableTransaction& tx, const std::string& cmdVal)
|
||||
{
|
||||
int64_t newVersion = atoi64(cmdVal);
|
||||
if (newVersion < 1 || newVersion > CTransaction::MAX_STANDARD_VERSION)
|
||||
throw std::runtime_error("Invalid TX version requested");
|
||||
int64_t newVersion;
|
||||
if (!ParseInt64(cmdVal, &newVersion) || newVersion < 1 || newVersion > CTransaction::MAX_STANDARD_VERSION)
|
||||
throw std::runtime_error("Invalid TX version requested: '" + cmdVal + "'");
|
||||
|
||||
tx.nVersion = (int) newVersion;
|
||||
}
|
||||
|
||||
static void MutateTxLocktime(CMutableTransaction& tx, const std::string& cmdVal)
|
||||
{
|
||||
int64_t newLocktime = atoi64(cmdVal);
|
||||
if (newLocktime < 0LL || newLocktime > 0xffffffffLL)
|
||||
throw std::runtime_error("Invalid TX locktime requested");
|
||||
int64_t newLocktime;
|
||||
if (!ParseInt64(cmdVal, &newLocktime) || newLocktime < 0LL || newLocktime > 0xffffffffLL)
|
||||
throw std::runtime_error("Invalid TX locktime requested: '" + cmdVal + "'");
|
||||
|
||||
tx.nLockTime = (unsigned int) newLocktime;
|
||||
}
|
||||
@ -225,10 +225,10 @@ static void MutateTxAddInput(CMutableTransaction& tx, const std::string& strInpu
|
||||
static const unsigned int maxVout = MaxBlockSize() / minTxOutSz;
|
||||
|
||||
// extract and validate vout
|
||||
std::string strVout = vStrInputParts[1];
|
||||
int vout = atoi(strVout);
|
||||
if ((vout < 0) || (vout > (int)maxVout))
|
||||
throw std::runtime_error("invalid TX input vout");
|
||||
const std::string& strVout = vStrInputParts[1];
|
||||
int64_t vout;
|
||||
if (!ParseInt64(strVout, &vout) || vout < 0 || vout > static_cast<int64_t>(maxVout))
|
||||
throw std::runtime_error("invalid TX input vout '" + strVout + "'");
|
||||
|
||||
// extract the optional sequence number
|
||||
uint32_t nSequenceIn=std::numeric_limits<unsigned int>::max();
|
||||
@ -433,10 +433,9 @@ static void MutateTxAddOutScript(CMutableTransaction& tx, const std::string& str
|
||||
static void MutateTxDelInput(CMutableTransaction& tx, const std::string& strInIdx)
|
||||
{
|
||||
// parse requested deletion index
|
||||
int inIdx = atoi(strInIdx);
|
||||
if (inIdx < 0 || inIdx >= (int)tx.vin.size()) {
|
||||
std::string strErr = "Invalid TX input index '" + strInIdx + "'";
|
||||
throw std::runtime_error(strErr.c_str());
|
||||
int64_t inIdx;
|
||||
if (!ParseInt64(strInIdx, &inIdx) || inIdx < 0 || inIdx >= static_cast<int64_t>(tx.vin.size())) {
|
||||
throw std::runtime_error("Invalid TX input index '" + strInIdx + "'");
|
||||
}
|
||||
|
||||
// delete input from transaction
|
||||
@ -446,10 +445,9 @@ static void MutateTxDelInput(CMutableTransaction& tx, const std::string& strInId
|
||||
static void MutateTxDelOutput(CMutableTransaction& tx, const std::string& strOutIdx)
|
||||
{
|
||||
// parse requested deletion index
|
||||
int outIdx = atoi(strOutIdx);
|
||||
if (outIdx < 0 || outIdx >= (int)tx.vout.size()) {
|
||||
std::string strErr = "Invalid TX output index '" + strOutIdx + "'";
|
||||
throw std::runtime_error(strErr.c_str());
|
||||
int64_t outIdx;
|
||||
if (!ParseInt64(strOutIdx, &outIdx) || outIdx < 0 || outIdx >= static_cast<int64_t>(tx.vout.size())) {
|
||||
throw std::runtime_error("Invalid TX output index '" + strOutIdx + "'");
|
||||
}
|
||||
|
||||
// delete output from transaction
|
||||
@ -547,7 +545,7 @@ static void MutateTxSign(CMutableTransaction& tx, const std::string& flagStr)
|
||||
|
||||
uint256 txid = ParseHashStr(prevOut["txid"].get_str(), "txid");
|
||||
|
||||
int nOut = atoi(prevOut["vout"].getValStr());
|
||||
const int nOut = prevOut["vout"].get_int();
|
||||
if (nOut < 0)
|
||||
throw std::runtime_error("vout must be positive");
|
||||
|
||||
|
@ -39,17 +39,17 @@ public:
|
||||
virtual bool HaveWatchOnly() const =0;
|
||||
};
|
||||
|
||||
typedef std::map<CKeyID, CKey> KeyMap;
|
||||
typedef std::map<CKeyID, CPubKey> WatchKeyMap;
|
||||
typedef std::map<CScriptID, CScript > ScriptMap;
|
||||
typedef std::set<CScript> WatchOnlySet;
|
||||
|
||||
/** Basic key store, that keeps keys in an address->secret map */
|
||||
class CBasicKeyStore : public CKeyStore
|
||||
{
|
||||
protected:
|
||||
mutable CCriticalSection cs_KeyStore;
|
||||
|
||||
using KeyMap = std::map<CKeyID, CKey>;
|
||||
using WatchKeyMap = std::map<CKeyID, CPubKey>;
|
||||
using ScriptMap = std::map<CScriptID, CScript>;
|
||||
using WatchOnlySet = std::set<CScript>;
|
||||
|
||||
KeyMap mapKeys GUARDED_BY(cs_KeyStore);
|
||||
WatchKeyMap mapWatchKeys GUARDED_BY(cs_KeyStore);
|
||||
ScriptMap mapScripts GUARDED_BY(cs_KeyStore);
|
||||
@ -77,7 +77,4 @@ public:
|
||||
virtual bool GetHDChain(CHDChain& hdChainRet) const;
|
||||
};
|
||||
|
||||
typedef std::vector<unsigned char, secure_allocator<unsigned char> > CKeyingMaterial;
|
||||
typedef std::map<CKeyID, std::pair<CPubKey, std::vector<unsigned char> > > CryptedKeyMap;
|
||||
|
||||
#endif // BITCOIN_KEYSTORE_H
|
||||
|
@ -115,6 +115,12 @@ public:
|
||||
* returns the merkle root, or 0 in case of failure
|
||||
*/
|
||||
uint256 ExtractMatches(std::vector<uint256> &vMatch, std::vector<unsigned int> &vnIndex);
|
||||
|
||||
/** Get number of transactions the merkle proof is indicating for cross-reference with
|
||||
* local blockchain knowledge.
|
||||
*/
|
||||
unsigned int GetNumTransactions() const { return nTransactions; };
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@ -757,7 +757,6 @@ UniValue submitblock(const JSONRPCRequest& request)
|
||||
}
|
||||
|
||||
uint256 hash = block.GetHash();
|
||||
bool fBlockPresent = false;
|
||||
{
|
||||
LOCK(cs_main);
|
||||
const CBlockIndex* pindex = LookupBlockIndex(hash);
|
||||
@ -768,18 +767,18 @@ UniValue submitblock(const JSONRPCRequest& request)
|
||||
if (pindex->nStatus & BLOCK_FAILED_MASK) {
|
||||
return "duplicate-invalid";
|
||||
}
|
||||
// Otherwise, we might only have the header - process the block before returning
|
||||
fBlockPresent = true;
|
||||
}
|
||||
}
|
||||
|
||||
bool new_block;
|
||||
submitblock_StateCatcher sc(block.GetHash());
|
||||
RegisterValidationInterface(&sc);
|
||||
bool fAccepted = ProcessNewBlock(Params(), blockptr, true, nullptr);
|
||||
bool accepted = ProcessNewBlock(Params(), blockptr, /* fForceProcessing */ true, /* fNewBlock */ &new_block);
|
||||
UnregisterValidationInterface(&sc);
|
||||
if (fBlockPresent) {
|
||||
if (fAccepted && !sc.found) {
|
||||
return "duplicate-inconclusive";
|
||||
if (!new_block) {
|
||||
if (!accepted) {
|
||||
// TODO Maybe pass down fNewBlock to AcceptBlockHeader, so it is properly set to true in this case?
|
||||
return "invalid";
|
||||
}
|
||||
return "duplicate";
|
||||
}
|
||||
|
@ -337,7 +337,7 @@ UniValue verifytxoutproof(const JSONRPCRequest& request)
|
||||
"\nArguments:\n"
|
||||
"1. \"proof\" (string, required) The hex-encoded proof generated by gettxoutproof\n"
|
||||
"\nResult:\n"
|
||||
"[\"txid\"] (array, strings) The txid(s) which the proof commits to, or empty array if the proof is invalid\n"
|
||||
"[\"txid\"] (array, strings) The txid(s) which the proof commits to, or empty array if the proof can not be validated.\n"
|
||||
|
||||
"\nExamples:\n"
|
||||
+ HelpExampleCli("verifytxoutproof", "\"proof\"")
|
||||
@ -358,12 +358,17 @@ UniValue verifytxoutproof(const JSONRPCRequest& request)
|
||||
LOCK(cs_main);
|
||||
|
||||
const CBlockIndex* pindex = LookupBlockIndex(merkleBlock.header.GetHash());
|
||||
if (!pindex || !chainActive.Contains(pindex)) {
|
||||
if (!pindex || !chainActive.Contains(pindex) || pindex->nTx == 0) {
|
||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Block not found in chain");
|
||||
}
|
||||
|
||||
for (const uint256& hash : vMatch)
|
||||
res.push_back(hash.GetHex());
|
||||
// Check if proof is valid, only add results if so
|
||||
if (pindex->nTx == merkleBlock.txn.GetNumTransactions()) {
|
||||
for (const uint256& hash : vMatch) {
|
||||
res.push_back(hash.GetHex());
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,7 @@ BOOST_AUTO_TEST_CASE(dbwrapper)
|
||||
{
|
||||
// Perform tests both obfuscated and non-obfuscated.
|
||||
for (bool obfuscate : {false, true}) {
|
||||
fs::path ph = fs::temp_directory_path() / fs::unique_path();
|
||||
fs::path ph = SetDataDir(std::string("dbwrapper").append(obfuscate ? "_true" : "_false"));
|
||||
CDBWrapper dbw(ph, (1 << 20), true, false, obfuscate);
|
||||
char key = 'k';
|
||||
uint256 in = InsecureRand256();
|
||||
@ -47,7 +47,7 @@ BOOST_AUTO_TEST_CASE(dbwrapper_batch)
|
||||
{
|
||||
// Perform tests both obfuscated and non-obfuscated.
|
||||
for (bool obfuscate : {false, true}) {
|
||||
fs::path ph = fs::temp_directory_path() / fs::unique_path();
|
||||
fs::path ph = SetDataDir(std::string("dbwrapper_batch").append(obfuscate ? "_true" : "_false"));
|
||||
CDBWrapper dbw(ph, (1 << 20), true, false, obfuscate);
|
||||
|
||||
char key = 'i';
|
||||
@ -83,7 +83,7 @@ BOOST_AUTO_TEST_CASE(dbwrapper_iterator)
|
||||
{
|
||||
// Perform tests both obfuscated and non-obfuscated.
|
||||
for (bool obfuscate : {false, true}) {
|
||||
fs::path ph = fs::temp_directory_path() / fs::unique_path();
|
||||
fs::path ph = SetDataDir(std::string("dbwrapper_iterator").append(obfuscate ? "_true" : "_false"));
|
||||
CDBWrapper dbw(ph, (1 << 20), true, false, obfuscate);
|
||||
|
||||
// The two keys are intentionally chosen for ordering
|
||||
@ -123,7 +123,7 @@ BOOST_AUTO_TEST_CASE(dbwrapper_iterator)
|
||||
BOOST_AUTO_TEST_CASE(existing_data_no_obfuscate)
|
||||
{
|
||||
// We're going to share this fs::path between two wrappers
|
||||
fs::path ph = fs::temp_directory_path() / fs::unique_path();
|
||||
fs::path ph = SetDataDir("existing_data_no_obfuscate");
|
||||
create_directories(ph);
|
||||
|
||||
// Set up a non-obfuscated wrapper to write some initial data.
|
||||
@ -164,7 +164,7 @@ BOOST_AUTO_TEST_CASE(existing_data_no_obfuscate)
|
||||
BOOST_AUTO_TEST_CASE(existing_data_reindex)
|
||||
{
|
||||
// We're going to share this fs::path between two wrappers
|
||||
fs::path ph = fs::temp_directory_path() / fs::unique_path();
|
||||
fs::path ph = SetDataDir("existing_data_reindex");
|
||||
create_directories(ph);
|
||||
|
||||
// Set up a non-obfuscated wrapper to write some initial data.
|
||||
@ -199,7 +199,7 @@ BOOST_AUTO_TEST_CASE(existing_data_reindex)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(iterator_ordering)
|
||||
{
|
||||
fs::path ph = fs::temp_directory_path() / fs::unique_path();
|
||||
fs::path ph = SetDataDir("iterator_ordering");
|
||||
CDBWrapper dbw(ph, (1 << 20), true, false, false);
|
||||
for (int x=0x00; x<256; ++x) {
|
||||
uint8_t key = x;
|
||||
@ -277,7 +277,7 @@ BOOST_AUTO_TEST_CASE(iterator_string_ordering)
|
||||
{
|
||||
char buf[10];
|
||||
|
||||
fs::path ph = fs::temp_directory_path() / fs::unique_path();
|
||||
fs::path ph = SetDataDir("iterator_string_ordering");
|
||||
CDBWrapper dbw(ph, (1 << 20), true, false, false);
|
||||
for (int x=0x00; x<10; ++x) {
|
||||
for (int y = 0; y < 10; y++) {
|
||||
|
@ -89,6 +89,7 @@ BOOST_AUTO_TEST_CASE(cnode_listen_port)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(caddrdb_read)
|
||||
{
|
||||
SetDataDir("caddrdb_read");
|
||||
CAddrManUncorrupted addrmanUncorrupted;
|
||||
addrmanUncorrupted.MakeDeterministic();
|
||||
|
||||
@ -134,6 +135,7 @@ BOOST_AUTO_TEST_CASE(caddrdb_read)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(caddrdb_read_corrupted)
|
||||
{
|
||||
SetDataDir("caddrdb_read_corrupted");
|
||||
CAddrManCorrupted addrmanCorrupted;
|
||||
addrmanCorrupted.MakeDeterministic();
|
||||
|
||||
|
@ -53,42 +53,50 @@ extern bool fPrintToConsole;
|
||||
extern void noui_connect();
|
||||
|
||||
BasicTestingSetup::BasicTestingSetup(const std::string& chainName)
|
||||
: m_path_root(fs::temp_directory_path() / "test_dash" / strprintf("%lu_%i", (unsigned long)GetTime(), (int)(InsecureRandRange(1 << 30))))
|
||||
{
|
||||
SHA256AutoDetect();
|
||||
RandomInit();
|
||||
ECC_Start();
|
||||
BLSInit();
|
||||
SetupEnvironment();
|
||||
SetupNetworking();
|
||||
InitSignatureCache();
|
||||
InitScriptExecutionCache();
|
||||
CPrivateSend::InitStandardDenominations();
|
||||
fPrintToDebugLog = false; // don't want to write to debug.log file
|
||||
fCheckBlockIndex = true;
|
||||
SelectParams(chainName);
|
||||
evoDb.reset(new CEvoDB(1 << 20, true, true));
|
||||
deterministicMNManager.reset(new CDeterministicMNManager(*evoDb));
|
||||
noui_connect();
|
||||
SHA256AutoDetect();
|
||||
RandomInit();
|
||||
ECC_Start();
|
||||
BLSInit();
|
||||
SetupEnvironment();
|
||||
SetupNetworking();
|
||||
InitSignatureCache();
|
||||
InitScriptExecutionCache();
|
||||
CPrivateSend::InitStandardDenominations();
|
||||
fPrintToDebugLog = false; // don't want to write to debug.log file
|
||||
fCheckBlockIndex = true;
|
||||
SelectParams(chainName);
|
||||
evoDb.reset(new CEvoDB(1 << 20, true, true));
|
||||
deterministicMNManager.reset(new CDeterministicMNManager(*evoDb));
|
||||
noui_connect();
|
||||
}
|
||||
|
||||
BasicTestingSetup::~BasicTestingSetup()
|
||||
{
|
||||
deterministicMNManager.reset();
|
||||
evoDb.reset();
|
||||
deterministicMNManager.reset();
|
||||
evoDb.reset();
|
||||
|
||||
ECC_Stop();
|
||||
fs::remove_all(m_path_root);
|
||||
ECC_Stop();
|
||||
}
|
||||
|
||||
fs::path BasicTestingSetup::SetDataDir(const std::string& name)
|
||||
{
|
||||
fs::path ret = m_path_root / name;
|
||||
fs::create_directories(ret);
|
||||
gArgs.ForceSetArg("-datadir", ret.string());
|
||||
return ret;
|
||||
}
|
||||
|
||||
TestingSetup::TestingSetup(const std::string& chainName) : BasicTestingSetup(chainName)
|
||||
{
|
||||
SetDataDir("tempdir");
|
||||
const CChainParams& chainparams = Params();
|
||||
// Ideally we'd move all the RPC tests to the functional testing framework
|
||||
// instead of unit tests, but for now we need these here.
|
||||
RegisterAllCoreRPCCommands(tableRPC);
|
||||
ClearDatadirCache();
|
||||
pathTemp = fs::temp_directory_path() / strprintf("test_dash_%lu_%i", (unsigned long)GetTime(), (int)(InsecureRandRange(100000)));
|
||||
fs::create_directories(pathTemp);
|
||||
gArgs.ForceSetArg("-datadir", pathTemp.string());
|
||||
|
||||
// We have to run a scheduler thread to prevent ActivateBestChain
|
||||
// from blocking due to queue overrun.
|
||||
@ -131,7 +139,6 @@ TestingSetup::~TestingSetup()
|
||||
llmq::DestroyLLMQSystem();
|
||||
pcoinsdbview.reset();
|
||||
pblocktree.reset();
|
||||
fs::remove_all(pathTemp);
|
||||
}
|
||||
|
||||
TestChainSetup::TestChainSetup(int blockCount) : TestingSetup(CBaseChainParams::REGTEST)
|
||||
|
@ -51,6 +51,11 @@ struct BasicTestingSetup {
|
||||
|
||||
explicit BasicTestingSetup(const std::string& chainName = CBaseChainParams::MAIN);
|
||||
~BasicTestingSetup();
|
||||
|
||||
fs::path SetDataDir(const std::string& name);
|
||||
|
||||
private:
|
||||
const fs::path m_path_root;
|
||||
};
|
||||
|
||||
/** Testing setup that configures a complete environment.
|
||||
@ -65,7 +70,6 @@ struct CConnmanTest {
|
||||
|
||||
class PeerLogicValidation;
|
||||
struct TestingSetup: public BasicTestingSetup {
|
||||
fs::path pathTemp;
|
||||
boost::thread_group threadGroup;
|
||||
CConnman* connman;
|
||||
CScheduler scheduler;
|
||||
|
@ -1125,7 +1125,7 @@ static void TestOtherProcess(fs::path dirname, std::string lockname, int fd)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(test_LockDirectory)
|
||||
{
|
||||
fs::path dirname = fs::temp_directory_path() / fs::unique_path();
|
||||
fs::path dirname = SetDataDir("test_LockDirectory") / fs::unique_path();
|
||||
const std::string lockname = ".lock";
|
||||
#ifndef WIN32
|
||||
// Revert SIGCHLD to default, otherwise boost.test will catch and fail on
|
||||
@ -1213,12 +1213,12 @@ BOOST_AUTO_TEST_CASE(test_LockDirectory)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(test_DirIsWritable)
|
||||
{
|
||||
// Should be able to write to the system tmp dir.
|
||||
fs::path tmpdirname = fs::temp_directory_path();
|
||||
// Should be able to write to the data dir.
|
||||
fs::path tmpdirname = SetDataDir("test_DirIsWritable");
|
||||
BOOST_CHECK_EQUAL(DirIsWritable(tmpdirname), true);
|
||||
|
||||
// Should not be able to write to a non-existent dir.
|
||||
tmpdirname = fs::temp_directory_path() / fs::unique_path();
|
||||
tmpdirname = tmpdirname / fs::unique_path();
|
||||
BOOST_CHECK_EQUAL(DirIsWritable(tmpdirname), false);
|
||||
|
||||
fs::create_directory(tmpdirname);
|
||||
|
@ -3875,7 +3875,6 @@ bool CChainState::AcceptBlock(const std::shared_ptr<const CBlock>& pblock, CVali
|
||||
// request; don't process these.
|
||||
if (pindex->nChainWork < nMinimumChainWork) return true;
|
||||
}
|
||||
if (fNewBlock) *fNewBlock = true;
|
||||
|
||||
if (!CheckBlock(block, state, chainparams.GetConsensus()) ||
|
||||
!ContextualCheckBlock(block, state, chainparams.GetConsensus(), pindex->pprev)) {
|
||||
@ -3892,6 +3891,7 @@ bool CChainState::AcceptBlock(const std::shared_ptr<const CBlock>& pblock, CVali
|
||||
GetMainSignals().NewPoWValidBlock(pindex, pblock);
|
||||
|
||||
// Write block to history file
|
||||
if (fNewBlock) *fNewBlock = true;
|
||||
try {
|
||||
CDiskBlockPos blockPos = SaveBlockToDisk(block, pindex->nHeight, chainparams, dbp);
|
||||
if (blockPos.IsNull()) {
|
||||
|
@ -134,6 +134,8 @@ private:
|
||||
bool fOnlyMixingAllowed;
|
||||
|
||||
protected:
|
||||
using CryptedKeyMap = std::map<CKeyID, std::pair<CPubKey, std::vector<unsigned char>>>;
|
||||
|
||||
bool SetCrypted();
|
||||
|
||||
//! will encrypt previously unencrypted keys
|
||||
|
@ -132,6 +132,8 @@ BOOST_FIXTURE_TEST_CASE(importwallet_rescan, TestChain100Setup)
|
||||
|
||||
LOCK(cs_main);
|
||||
|
||||
std::string backup_file = (SetDataDir("importwallet_rescan") / "wallet.backup").string();
|
||||
|
||||
// Import key into wallet and call dumpwallet to create backup file.
|
||||
{
|
||||
CWallet wallet("dummy", WalletDatabase::CreateDummy());
|
||||
@ -141,7 +143,7 @@ BOOST_FIXTURE_TEST_CASE(importwallet_rescan, TestChain100Setup)
|
||||
|
||||
JSONRPCRequest request;
|
||||
request.params.setArray();
|
||||
request.params.push_back((pathTemp / "wallet.backup").string());
|
||||
request.params.push_back(backup_file);
|
||||
AddWallet(&wallet);
|
||||
::dumpwallet(request);
|
||||
RemoveWallet(&wallet);
|
||||
@ -154,7 +156,7 @@ BOOST_FIXTURE_TEST_CASE(importwallet_rescan, TestChain100Setup)
|
||||
|
||||
JSONRPCRequest request;
|
||||
request.params.setArray();
|
||||
request.params.push_back((pathTemp / "wallet.backup").string());
|
||||
request.params.push_back(backup_file);
|
||||
AddWallet(&wallet);
|
||||
::importwallet(request);
|
||||
RemoveWallet(&wallet);
|
||||
|
@ -5497,7 +5497,7 @@ void CMerkleTx::SetMerkleBranch(const CBlockIndex* pindex, int posInBlock)
|
||||
nIndex = posInBlock;
|
||||
}
|
||||
|
||||
int CMerkleTx::GetDepthInMainChain(const CBlockIndex* &pindexRet) const
|
||||
int CMerkleTx::GetDepthInMainChain() const
|
||||
{
|
||||
int nResult;
|
||||
|
||||
@ -5511,7 +5511,6 @@ int CMerkleTx::GetDepthInMainChain(const CBlockIndex* &pindexRet) const
|
||||
if (!pindex || !chainActive.Contains(pindex))
|
||||
return 0;
|
||||
|
||||
pindexRet = pindex;
|
||||
return ((nIndex == -1) ? (-1) : 1) * (chainActive.Height() - pindex->nHeight + 1);
|
||||
}
|
||||
|
||||
@ -5541,7 +5540,9 @@ int CMerkleTx::GetBlocksToMaturity() const
|
||||
{
|
||||
if (!IsCoinBase())
|
||||
return 0;
|
||||
return std::max(0, (COINBASE_MATURITY+1) - GetDepthInMainChain());
|
||||
int chain_depth = GetDepthInMainChain();
|
||||
assert(chain_depth >= 0); // coinbase tx should not be conflicted
|
||||
return std::max(0, (COINBASE_MATURITY+1) - chain_depth);
|
||||
}
|
||||
|
||||
|
||||
|
@ -260,9 +260,8 @@ public:
|
||||
* 0 : in memory pool, waiting to be included in a block
|
||||
* >=1 : this many blocks deep in the main chain
|
||||
*/
|
||||
int GetDepthInMainChain(const CBlockIndex* &pindexRet) const;
|
||||
int GetDepthInMainChain() const { const CBlockIndex *pindexRet; return GetDepthInMainChain(pindexRet); }
|
||||
bool IsInMainChain() const { const CBlockIndex *pindexRet; return GetDepthInMainChain(pindexRet) > 0; }
|
||||
int GetDepthInMainChain() const;
|
||||
bool IsInMainChain() const { return GetDepthInMainChain() > 0; }
|
||||
bool IsLockedByInstantSend() const;
|
||||
bool IsChainLocked() const;
|
||||
int GetBlocksToMaturity() const;
|
||||
|
@ -3,17 +3,17 @@
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
"""Test the ZMQ notification interface."""
|
||||
import configparser
|
||||
import struct
|
||||
|
||||
from codecs import encode
|
||||
|
||||
from test_framework.test_framework import (
|
||||
BitcoinTestFramework, skip_if_no_bitcoind_zmq, skip_if_no_py3_zmq)
|
||||
from test_framework.mininode import dashhash
|
||||
from test_framework.test_framework import BitcoinTestFramework, SkipTest
|
||||
from test_framework.util import (assert_equal,
|
||||
bytes_to_hex_str,
|
||||
hash256,
|
||||
)
|
||||
)
|
||||
|
||||
def dashhash_helper(b):
|
||||
return encode(dashhash(b)[::-1], 'hex_codec').decode('ascii')
|
||||
@ -42,18 +42,9 @@ class ZMQTest (BitcoinTestFramework):
|
||||
self.num_nodes = 2
|
||||
|
||||
def setup_nodes(self):
|
||||
# Try to import python3-zmq. Skip this test if the import fails.
|
||||
try:
|
||||
import zmq
|
||||
except ImportError:
|
||||
raise SkipTest("python3-zmq module not available.")
|
||||
|
||||
# Check that dash has been built with ZMQ enabled.
|
||||
config = configparser.ConfigParser()
|
||||
config.read_file(open(self.options.configfile))
|
||||
|
||||
if not config["components"].getboolean("ENABLE_ZMQ"):
|
||||
raise SkipTest("dashd has not been built with zmq enabled.")
|
||||
skip_if_no_py3_zmq()
|
||||
skip_if_no_bitcoind_zmq(self)
|
||||
import zmq
|
||||
|
||||
# Initialize ZMQ context and socket.
|
||||
# All messages are received in the same socket which means
|
||||
|
@ -11,9 +11,13 @@ import json
|
||||
import random
|
||||
import struct
|
||||
import time
|
||||
import zmq
|
||||
try:
|
||||
import zmq
|
||||
finally:
|
||||
pass
|
||||
|
||||
from test_framework.test_framework import DashTestFramework, SkipTest
|
||||
from test_framework.test_framework import (
|
||||
DashTestFramework, skip_if_no_bitcoind_zmq, skip_if_no_py3_zmq)
|
||||
from test_framework.mininode import P2PInterface, network_thread_start
|
||||
from test_framework.util import assert_equal, assert_raises_rpc_error, bytes_to_hex_str
|
||||
from test_framework.messages import (
|
||||
@ -96,8 +100,8 @@ class DashZMQTest (DashTestFramework):
|
||||
config = configparser.ConfigParser()
|
||||
config.read_file(open(self.options.configfile))
|
||||
|
||||
if not config["components"].getboolean("ENABLE_ZMQ"):
|
||||
raise SkipTest("dashd has not been built with zmq enabled.")
|
||||
skip_if_no_py3_zmq()
|
||||
skip_if_no_bitcoind_zmq(self)
|
||||
|
||||
try:
|
||||
# Setup the ZMQ subscriber socket
|
||||
|
@ -6,6 +6,8 @@
|
||||
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.util import *
|
||||
from test_framework.mininode import FromHex, ToHex
|
||||
from test_framework.messages import CMerkleBlock
|
||||
|
||||
class MerkleBlockTest(BitcoinTestFramework):
|
||||
def set_test_params(self):
|
||||
@ -80,6 +82,27 @@ class MerkleBlockTest(BitcoinTestFramework):
|
||||
# We can't get a proof if we specify transactions from different blocks
|
||||
assert_raises_rpc_error(-5, "Not all transactions found in specified or retrieved block", self.nodes[2].gettxoutproof, [txid1, txid3])
|
||||
|
||||
# Now we'll try tweaking a proof.
|
||||
proof = self.nodes[3].gettxoutproof([txid1, txid2])
|
||||
assert txid1 in self.nodes[0].verifytxoutproof(proof)
|
||||
assert txid2 in self.nodes[1].verifytxoutproof(proof)
|
||||
|
||||
tweaked_proof = FromHex(CMerkleBlock(), proof)
|
||||
|
||||
# Make sure that our serialization/deserialization is working
|
||||
assert txid1 in self.nodes[2].verifytxoutproof(ToHex(tweaked_proof))
|
||||
|
||||
# Check to see if we can go up the merkle tree and pass this off as a
|
||||
# single-transaction block
|
||||
tweaked_proof.txn.nTransactions = 1
|
||||
tweaked_proof.txn.vHash = [tweaked_proof.header.hashMerkleRoot]
|
||||
tweaked_proof.txn.vBits = [True] + [False]*7
|
||||
|
||||
for n in self.nodes:
|
||||
assert not n.verifytxoutproof(ToHex(tweaked_proof))
|
||||
|
||||
# TODO: try more variants, eg transactions at different depths, and
|
||||
# verify that the proofs are invalid
|
||||
|
||||
if __name__ == '__main__':
|
||||
MerkleBlockTest().main()
|
||||
|
@ -4,7 +4,8 @@
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
"""Test for the ZMQ RPC methods."""
|
||||
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.test_framework import (
|
||||
BitcoinTestFramework, skip_if_no_py3_zmq, skip_if_no_bitcoind_zmq)
|
||||
from test_framework.util import assert_equal
|
||||
|
||||
|
||||
@ -17,6 +18,8 @@ class RPCZMQTest(BitcoinTestFramework):
|
||||
self.setup_clean_chain = True
|
||||
|
||||
def run_test(self):
|
||||
skip_if_no_py3_zmq()
|
||||
skip_if_no_bitcoind_zmq(self)
|
||||
self._test_getzmqnotifications()
|
||||
|
||||
def _test_getzmqnotifications(self):
|
||||
|
@ -738,6 +738,7 @@ class CPartialMerkleTree():
|
||||
self.nTransactions = 0
|
||||
self.vBits = []
|
||||
self.vHash = []
|
||||
self.fBad = False
|
||||
|
||||
def deserialize(self, f):
|
||||
self.nTransactions = struct.unpack("<I", f.read(4))[0]
|
||||
|
@ -1078,3 +1078,20 @@ class SkipTest(Exception):
|
||||
"""This exception is raised to skip a test"""
|
||||
def __init__(self, message):
|
||||
self.message = message
|
||||
|
||||
|
||||
def skip_if_no_py3_zmq():
|
||||
"""Attempt to import the zmq package and skip the test if the import fails."""
|
||||
try:
|
||||
import zmq # noqa
|
||||
except ImportError:
|
||||
raise SkipTest("python3-zmq module not available.")
|
||||
|
||||
|
||||
def skip_if_no_bitcoind_zmq(test_instance):
|
||||
"""Skip the running test if dashd has not been compiled with zmq support."""
|
||||
config = configparser.ConfigParser()
|
||||
config.read_file(open(test_instance.options.configfile))
|
||||
|
||||
if not config["components"].getboolean("ENABLE_ZMQ"):
|
||||
raise SkipTest("dashd has not been built with zmq enabled.")
|
||||
|
@ -15,6 +15,7 @@ import re
|
||||
import subprocess
|
||||
import tempfile
|
||||
import time
|
||||
import urllib.parse
|
||||
|
||||
from .authproxy import JSONRPCException
|
||||
from .messages import MY_SUBVERSION
|
||||
@ -167,7 +168,7 @@ class TestNode():
|
||||
return self.cli("-rpcwallet={}".format(wallet_name))
|
||||
else:
|
||||
assert self.rpc_connected and self.rpc, self._node_msg("RPC not connected")
|
||||
wallet_path = "wallet/%s" % wallet_name
|
||||
wallet_path = "wallet/{}".format(urllib.parse.quote(wallet_name))
|
||||
return self.rpc / wallet_path
|
||||
|
||||
def stop_node(self, wait=0):
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Copyright (c) 2017 The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Copyright (c) 2018 The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Copyright (c) 2018 The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Copyright (c) 2018 The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
export LC_ALL=C
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Copyright (c) 2018 The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
# Shebang must use python3 (not python or python2)
|
||||
|
||||
export LC_ALL=C
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Copyright (c) 2018 The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Copyright (c) 2018 The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Copyright (c) 2018 The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Copyright (c) 2018 The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Copyright (c) 2017 The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
|
@ -26,6 +26,12 @@
|
||||
"output_cmp": "blanktxv2.json",
|
||||
"description": "Creates a blank transaction when nothing is piped into dash-tx (output in json)"
|
||||
},
|
||||
{ "exec": "./dash-tx",
|
||||
"args": ["-create", "nversion=1foo"],
|
||||
"return_code": 1,
|
||||
"error_txt": "error: Invalid TX version requested",
|
||||
"description": "Tests the check for invalid nversion value"
|
||||
},
|
||||
{ "exec": "./dash-tx",
|
||||
"args": ["-", "delin=1"],
|
||||
"input": "tx394b54bb.hex",
|
||||
@ -45,6 +51,13 @@
|
||||
"error_txt": "error: Invalid TX input index '31'",
|
||||
"description": "Attempts to delete an input with a bad index from a transaction. Expected to fail."
|
||||
},
|
||||
{ "exec": "./dash-tx",
|
||||
"args": ["-", "delin=1foo"],
|
||||
"input": "tx394b54bb.hex",
|
||||
"return_code": 1,
|
||||
"error_txt": "error: Invalid TX input index",
|
||||
"description": "Tests the check for an invalid input index with delin"
|
||||
},
|
||||
{ "exec": "./dash-tx",
|
||||
"args": ["-", "delout=1"],
|
||||
"input": "tx394b54bb.hex",
|
||||
@ -64,6 +77,13 @@
|
||||
"error_txt": "error: Invalid TX output index '2'",
|
||||
"description": "Attempts to delete an output with a bad index from a transaction. Expected to fail."
|
||||
},
|
||||
{ "exec": "./dash-tx",
|
||||
"args": ["-", "delout=1foo"],
|
||||
"input": "tx394b54bb.hex",
|
||||
"return_code": 1,
|
||||
"error_txt": "error: Invalid TX output index",
|
||||
"description": "Tests the check for an invalid output index with delout"
|
||||
},
|
||||
{ "exec": "./dash-tx",
|
||||
"args": ["-", "locktime=317000"],
|
||||
"input": "tx394b54bb.hex",
|
||||
@ -76,6 +96,20 @@
|
||||
"output_cmp": "tt-locktime317000-out.json",
|
||||
"description": "Adds an nlocktime to a transaction (output in json)"
|
||||
},
|
||||
{ "exec": "./dash-tx",
|
||||
"args": ["-create", "locktime=317000foo"],
|
||||
"return_code": 1,
|
||||
"error_txt": "error: Invalid TX locktime requested",
|
||||
"description": "Tests the check for invalid locktime value"
|
||||
},
|
||||
{ "exec": "./dash-tx",
|
||||
"args":
|
||||
["-create",
|
||||
"in=5897de6bd6027a475eadd57019d4e6872c396d0716c4875a5f1a6fcfdf385c1f:0x"],
|
||||
"return_code": 1,
|
||||
"error_txt": "error: invalid TX input vout",
|
||||
"description": "Tests the check for an invalid vout value when adding an input"
|
||||
},
|
||||
{ "exec": "./dash-tx",
|
||||
"args":
|
||||
["-create",
|
||||
@ -205,6 +239,18 @@
|
||||
"output_cmp": "txcreatesignv2.hex",
|
||||
"description": "Creates a new transaction with a single input and a single output, and then signs the transaction"
|
||||
},
|
||||
{ "exec": "./dash-tx",
|
||||
"args":
|
||||
["-create",
|
||||
"in=4d49a71ec9da436f71ec4ee231d04f292a29cd316f598bb7068feccabdc59485:0",
|
||||
"set=privatekeys:[\"7qYrzJZWqnyCWMYswFcqaRJypGdVceudXPSxmZKsngN7fyo7aAV\"]",
|
||||
"set=prevtxs:[{\"txid\":\"4d49a71ec9da436f71ec4ee231d04f292a29cd316f598bb7068feccabdc59485\",\"vout\":\"0foo\",\"scriptPubKey\":\"76a91491b24bf9f5288532960ac687abb035127b1d28a588ac\"}]",
|
||||
"sign=ALL",
|
||||
"outaddr=0.001:XijDvbYpPmznwgpWD3DkdYNfGmRP2KoVSk"],
|
||||
"return_code": 1,
|
||||
"error_txt": "error: prevtxs internal object typecheck fail",
|
||||
"description": "Tests the check for invalid vout index in prevtxs for sign"
|
||||
},
|
||||
{ "exec": "./dash-tx",
|
||||
"args":
|
||||
["-create", "outpubkey=0:02a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397", "nversion=1"],
|
||||
|
Loading…
Reference in New Issue
Block a user