all unit tests working except for miner_tests, not enough nonces to spend (need 110)
This commit is contained in:
parent
4f9dc759bc
commit
5a52585419
@ -171,10 +171,10 @@ public:
|
||||
vSeeds.emplace_back("ind.entertheblockchain.com", false);
|
||||
vSeeds.emplace_back("de.entertheblockchain.com", false);
|
||||
|
||||
base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1,35);
|
||||
base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1,8);
|
||||
base58Prefixes[SCRIPT_ADDRESS2] = std::vector<unsigned char>(1,94);
|
||||
base58Prefixes[SECRET_KEY] = std::vector<unsigned char>(1,163);
|
||||
base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1,35); //F
|
||||
base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1,8); //4
|
||||
base58Prefixes[SCRIPT_ADDRESS2] = std::vector<unsigned char>(1,94); //e or f
|
||||
base58Prefixes[SECRET_KEY] = std::vector<unsigned char>(1,163); //2
|
||||
base58Prefixes[EXT_PUBLIC_KEY] = {0x01, 0x34, 0x40, 0x6b}; //Fpub, Fprv for mainnet
|
||||
base58Prefixes[EXT_SECRET_KEY] = {0x01, 0x34, 0x3c, 0x31};
|
||||
|
||||
|
||||
@ -11,6 +11,8 @@
|
||||
#include "uint256.h"
|
||||
#include "util.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHeader *pblock, const Consensus::Params& params)
|
||||
{
|
||||
assert(pindexLast != nullptr);
|
||||
@ -110,6 +112,10 @@ bool CheckProofOfWork(uint256 hash, unsigned int nBits, const Consensus::Params&
|
||||
if (fNegative || bnTarget == 0 || fOverflow || bnTarget > UintToArith256(params.powLimit))
|
||||
return false;
|
||||
|
||||
// uint256 target=ArithToUint256(bnTarget);
|
||||
// std::cout << "target: " << target.ToString() << "\thash: " << hash.ToString() << "\n";
|
||||
|
||||
|
||||
// Check proof of work matches claimed amount
|
||||
if (UintToArith256(hash) > bnTarget)
|
||||
return false;
|
||||
|
||||
28
src/test/data/tx_invalid.json
Normal file → Executable file
28
src/test/data/tx_invalid.json
Normal file → Executable file
@ -201,49 +201,49 @@
|
||||
|
||||
["By-height locks, with argument just beyond txin.nSequence"],
|
||||
[[["0000000000000000000000000000000000000000000000000000000000000100", 0, "1 CHECKSEQUENCEVERIFY 1"]],
|
||||
"020000000100010000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
|
||||
"02000000010001000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
|
||||
[[["0000000000000000000000000000000000000000000000000000000000000100", 0, "4259839 CHECKSEQUENCEVERIFY 1"]],
|
||||
"020000000100010000000000000000000000000000000000000000000000000000000000000000000000feff40000100000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
|
||||
"020000000100010000000000000000000000000000000000000000000000000000000000000000000000feff4000010000000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
|
||||
|
||||
["By-time locks, with argument just beyond txin.nSequence (but within numerical boundries)"],
|
||||
[[["0000000000000000000000000000000000000000000000000000000000000100", 0, "4194305 CHECKSEQUENCEVERIFY 1"]],
|
||||
"020000000100010000000000000000000000000000000000000000000000000000000000000000000000000040000100000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
|
||||
"02000000010001000000000000000000000000000000000000000000000000000000000000000000000000004000010000000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
|
||||
[[["0000000000000000000000000000000000000000000000000000000000000100", 0, "4259839 CHECKSEQUENCEVERIFY 1"]],
|
||||
"020000000100010000000000000000000000000000000000000000000000000000000000000000000000feff40000100000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
|
||||
"020000000100010000000000000000000000000000000000000000000000000000000000000000000000feff4000010000000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
|
||||
|
||||
["Argument missing"],
|
||||
[[["0000000000000000000000000000000000000000000000000000000000000100", 0, "CHECKSEQUENCEVERIFY 1"]],
|
||||
"020000000100010000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
|
||||
"02000000010001000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
|
||||
|
||||
["Argument negative with by-blockheight txin.nSequence=0"],
|
||||
[[["0000000000000000000000000000000000000000000000000000000000000100", 0, "-1 CHECKSEQUENCEVERIFY 1"]],
|
||||
"020000000100010000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
|
||||
"02000000010001000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
|
||||
|
||||
["Argument negative with by-blocktime txin.nSequence=CTxIn::SEQUENCE_LOCKTIME_TYPE_FLAG"],
|
||||
[[["0000000000000000000000000000000000000000000000000000000000000100", 0, "-1 CHECKSEQUENCEVERIFY 1"]],
|
||||
"020000000100010000000000000000000000000000000000000000000000000000000000000000000000000040000100000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
|
||||
"02000000010001000000000000000000000000000000000000000000000000000000000000000000000000004000010000000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
|
||||
|
||||
["Argument/tx height/time mismatch, both versions"],
|
||||
[[["0000000000000000000000000000000000000000000000000000000000000100", 0, "0 CHECKSEQUENCEVERIFY 1"]],
|
||||
"020000000100010000000000000000000000000000000000000000000000000000000000000000000000000040000100000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
|
||||
"02000000010001000000000000000000000000000000000000000000000000000000000000000000000000004000010000000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
|
||||
[[["0000000000000000000000000000000000000000000000000000000000000100", 0, "65535 CHECKSEQUENCEVERIFY 1"]],
|
||||
"020000000100010000000000000000000000000000000000000000000000000000000000000000000000000040000100000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
|
||||
"02000000010001000000000000000000000000000000000000000000000000000000000000000000000000004000010000000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
|
||||
[[["0000000000000000000000000000000000000000000000000000000000000100", 0, "4194304 CHECKSEQUENCEVERIFY 1"]],
|
||||
"020000000100010000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
|
||||
"02000000010001000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
|
||||
[[["0000000000000000000000000000000000000000000000000000000000000100", 0, "4259839 CHECKSEQUENCEVERIFY 1"]],
|
||||
"020000000100010000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
|
||||
"02000000010001000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
|
||||
|
||||
["6 byte non-minimally-encoded arguments are invalid even if their contents are valid"],
|
||||
[[["0000000000000000000000000000000000000000000000000000000000000100", 0, "0x06 0x000000000000 CHECKSEQUENCEVERIFY 1"]],
|
||||
"020000000100010000000000000000000000000000000000000000000000000000000000000000000000ffff00000100000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
|
||||
"020000000100010000000000000000000000000000000000000000000000000000000000000000000000ffff0000010000000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
|
||||
|
||||
["Failure due to failing CHECKSEQUENCEVERIFY in scriptSig"],
|
||||
[[["0000000000000000000000000000000000000000000000000000000000000100", 0, "1"]],
|
||||
"02000000010001000000000000000000000000000000000000000000000000000000000000000000000251b2000000000100000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
|
||||
"02000000010001000000000000000000000000000000000000000000000000000000000000000000000251b200000000010000000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
|
||||
|
||||
["Failure due to failing CHECKSEQUENCEVERIFY in redeemScript"],
|
||||
[[["0000000000000000000000000000000000000000000000000000000000000100", 0, "HASH160 0x14 0x7c17aff532f22beb54069942f9bf567a66133eaf EQUAL"]],
|
||||
"0200000001000100000000000000000000000000000000000000000000000000000000000000000000030251b2000000000100000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
|
||||
"0200000001000100000000000000000000000000000000000000000000000000000000000000000000030251b200000000010000000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
|
||||
|
||||
["Failure due to insufficient tx.nVersion (<2)"],
|
||||
[[["0000000000000000000000000000000000000000000000000000000000000100", 0, "0 CHECKSEQUENCEVERIFY 1"]],
|
||||
|
||||
62
src/test/data/tx_valid.json
Normal file → Executable file
62
src/test/data/tx_valid.json
Normal file → Executable file
@ -1,7 +1,7 @@
|
||||
[
|
||||
["The following are deserialized transactions which are valid."],
|
||||
["They are in the form"],
|
||||
["[[[prevout hash, prevout index, prevout scriptPubKey, amount?], [input 2], ...],"],
|
||||
["[[[prevout hash, prevout index, prevout scriptPubKey, amount?] , [input 2], ...],"],
|
||||
["serializedTransaction, verifyFlags]"],
|
||||
["Objects that are only a single string (like this one) are ignored"],
|
||||
|
||||
@ -237,85 +237,85 @@
|
||||
|
||||
["By-height locks, with argument == 0 and == txin.nSequence"],
|
||||
[[["0000000000000000000000000000000000000000000000000000000000000100", 0, "0 CHECKSEQUENCEVERIFY 1"]],
|
||||
"020000000100010000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
|
||||
"02000000010001000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
|
||||
[[["0000000000000000000000000000000000000000000000000000000000000100", 0, "65535 CHECKSEQUENCEVERIFY 1"]],
|
||||
"020000000100010000000000000000000000000000000000000000000000000000000000000000000000ffff00000100000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
|
||||
"020000000100010000000000000000000000000000000000000000000000000000000000000000000000ffff0000010000000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
|
||||
[[["0000000000000000000000000000000000000000000000000000000000000100", 0, "65535 CHECKSEQUENCEVERIFY 1"]],
|
||||
"020000000100010000000000000000000000000000000000000000000000000000000000000000000000ffffbf7f0100000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
|
||||
"020000000100010000000000000000000000000000000000000000000000000000000000000000000000ffffbf7f010000000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
|
||||
[[["0000000000000000000000000000000000000000000000000000000000000100", 0, "0 CHECKSEQUENCEVERIFY 1"]],
|
||||
"020000000100010000000000000000000000000000000000000000000000000000000000000000000000ffffbf7f0100000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
|
||||
"020000000100010000000000000000000000000000000000000000000000000000000000000000000000ffffbf7f010000000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
|
||||
|
||||
["By-time locks, with argument == 0 and == txin.nSequence"],
|
||||
[[["0000000000000000000000000000000000000000000000000000000000000100", 0, "4194304 CHECKSEQUENCEVERIFY 1"]],
|
||||
"020000000100010000000000000000000000000000000000000000000000000000000000000000000000000040000100000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
|
||||
"02000000010001000000000000000000000000000000000000000000000000000000000000000000000000004000010000000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
|
||||
[[["0000000000000000000000000000000000000000000000000000000000000100", 0, "4259839 CHECKSEQUENCEVERIFY 1"]],
|
||||
"020000000100010000000000000000000000000000000000000000000000000000000000000000000000ffff40000100000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
|
||||
"020000000100010000000000000000000000000000000000000000000000000000000000000000000000ffff4000010000000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
|
||||
[[["0000000000000000000000000000000000000000000000000000000000000100", 0, "4259839 CHECKSEQUENCEVERIFY 1"]],
|
||||
"020000000100010000000000000000000000000000000000000000000000000000000000000000000000ffffff7f0100000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
|
||||
"020000000100010000000000000000000000000000000000000000000000000000000000000000000000ffffff7f010000000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
|
||||
[[["0000000000000000000000000000000000000000000000000000000000000100", 0, "4194304 CHECKSEQUENCEVERIFY 1"]],
|
||||
"020000000100010000000000000000000000000000000000000000000000000000000000000000000000ffffff7f0100000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
|
||||
"020000000100010000000000000000000000000000000000000000000000000000000000000000000000ffffff7f010000000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
|
||||
|
||||
["Upper sequence with upper sequence is fine"],
|
||||
[[["0000000000000000000000000000000000000000000000000000000000000100", 0, "2147483648 CHECKSEQUENCEVERIFY 1"]],
|
||||
"020000000100010000000000000000000000000000000000000000000000000000000000000000000000000000800100000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
|
||||
"02000000010001000000000000000000000000000000000000000000000000000000000000000000000000000080010000000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
|
||||
[[["0000000000000000000000000000000000000000000000000000000000000100", 0, "4294967295 CHECKSEQUENCEVERIFY 1"]],
|
||||
"020000000100010000000000000000000000000000000000000000000000000000000000000000000000000000800100000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
|
||||
"02000000010001000000000000000000000000000000000000000000000000000000000000000000000000000080010000000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
|
||||
[[["0000000000000000000000000000000000000000000000000000000000000100", 0, "2147483648 CHECKSEQUENCEVERIFY 1"]],
|
||||
"020000000100010000000000000000000000000000000000000000000000000000000000000000000000feffffff0100000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
|
||||
"020000000100010000000000000000000000000000000000000000000000000000000000000000000000feffffff010000000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
|
||||
[[["0000000000000000000000000000000000000000000000000000000000000100", 0, "4294967295 CHECKSEQUENCEVERIFY 1"]],
|
||||
"020000000100010000000000000000000000000000000000000000000000000000000000000000000000feffffff0100000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
|
||||
"020000000100010000000000000000000000000000000000000000000000000000000000000000000000feffffff010000000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
|
||||
[[["0000000000000000000000000000000000000000000000000000000000000100", 0, "2147483648 CHECKSEQUENCEVERIFY 1"]],
|
||||
"020000000100010000000000000000000000000000000000000000000000000000000000000000000000ffffffff0100000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
|
||||
"020000000100010000000000000000000000000000000000000000000000000000000000000000000000ffffffff010000000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
|
||||
[[["0000000000000000000000000000000000000000000000000000000000000100", 0, "4294967295 CHECKSEQUENCEVERIFY 1"]],
|
||||
"020000000100010000000000000000000000000000000000000000000000000000000000000000000000ffffffff0100000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
|
||||
"020000000100010000000000000000000000000000000000000000000000000000000000000000000000ffffffff010000000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
|
||||
|
||||
["Argument 2^31 with various nSequence"],
|
||||
[[["0000000000000000000000000000000000000000000000000000000000000100", 0, "2147483648 CHECKSEQUENCEVERIFY 1"]],
|
||||
"020000000100010000000000000000000000000000000000000000000000000000000000000000000000ffffbf7f0100000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
|
||||
"020000000100010000000000000000000000000000000000000000000000000000000000000000000000ffffbf7f010000000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
|
||||
[[["0000000000000000000000000000000000000000000000000000000000000100", 0, "2147483648 CHECKSEQUENCEVERIFY 1"]],
|
||||
"020000000100010000000000000000000000000000000000000000000000000000000000000000000000ffffff7f0100000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
|
||||
"020000000100010000000000000000000000000000000000000000000000000000000000000000000000ffffff7f010000000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
|
||||
[[["0000000000000000000000000000000000000000000000000000000000000100", 0, "2147483648 CHECKSEQUENCEVERIFY 1"]],
|
||||
"020000000100010000000000000000000000000000000000000000000000000000000000000000000000ffffffff0100000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
|
||||
"020000000100010000000000000000000000000000000000000000000000000000000000000000000000ffffffff010000000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
|
||||
|
||||
["Argument 2^32-1 with various nSequence"],
|
||||
[[["0000000000000000000000000000000000000000000000000000000000000100", 0, "4294967295 CHECKSEQUENCEVERIFY 1"]],
|
||||
"020000000100010000000000000000000000000000000000000000000000000000000000000000000000ffffbf7f0100000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
|
||||
"020000000100010000000000000000000000000000000000000000000000000000000000000000000000ffffbf7f010000000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
|
||||
[[["0000000000000000000000000000000000000000000000000000000000000100", 0, "4294967295 CHECKSEQUENCEVERIFY 1"]],
|
||||
"020000000100010000000000000000000000000000000000000000000000000000000000000000000000ffffff7f0100000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
|
||||
"020000000100010000000000000000000000000000000000000000000000000000000000000000000000ffffff7f010000000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
|
||||
[[["0000000000000000000000000000000000000000000000000000000000000100", 0, "4294967295 CHECKSEQUENCEVERIFY 1"]],
|
||||
"020000000100010000000000000000000000000000000000000000000000000000000000000000000000ffffffff0100000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
|
||||
"020000000100010000000000000000000000000000000000000000000000000000000000000000000000ffffffff010000000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
|
||||
|
||||
["Argument 3<<31 with various nSequence"],
|
||||
[[["0000000000000000000000000000000000000000000000000000000000000100", 0, "6442450944 CHECKSEQUENCEVERIFY 1"]],
|
||||
"020000000100010000000000000000000000000000000000000000000000000000000000000000000000ffffbf7f0100000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
|
||||
"020000000100010000000000000000000000000000000000000000000000000000000000000000000000ffffbf7f010000000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
|
||||
[[["0000000000000000000000000000000000000000000000000000000000000100", 0, "6442450944 CHECKSEQUENCEVERIFY 1"]],
|
||||
"020000000100010000000000000000000000000000000000000000000000000000000000000000000000ffffff7f0100000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
|
||||
"020000000100010000000000000000000000000000000000000000000000000000000000000000000000ffffff7f010000000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
|
||||
[[["0000000000000000000000000000000000000000000000000000000000000100", 0, "6442450944 CHECKSEQUENCEVERIFY 1"]],
|
||||
"020000000100010000000000000000000000000000000000000000000000000000000000000000000000ffffffff0100000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
|
||||
"020000000100010000000000000000000000000000000000000000000000000000000000000000000000ffffffff010000000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
|
||||
|
||||
["5 byte non-minimally-encoded operandss are valid"],
|
||||
[[["0000000000000000000000000000000000000000000000000000000000000100", 0, "0x05 0x0000000000 CHECKSEQUENCEVERIFY 1"]],
|
||||
"020000000100010000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
|
||||
"02000000010001000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
|
||||
|
||||
["The argument can be calculated rather than created directly by a PUSHDATA"],
|
||||
[[["0000000000000000000000000000000000000000000000000000000000000100", 0, "4194303 1ADD CHECKSEQUENCEVERIFY 1"]],
|
||||
"020000000100010000000000000000000000000000000000000000000000000000000000000000000000000040000100000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
|
||||
"02000000010001000000000000000000000000000000000000000000000000000000000000000000000000004000010000000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
|
||||
[[["0000000000000000000000000000000000000000000000000000000000000100", 0, "4194304 1SUB CHECKSEQUENCEVERIFY 1"]],
|
||||
"020000000100010000000000000000000000000000000000000000000000000000000000000000000000ffff00000100000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
|
||||
"020000000100010000000000000000000000000000000000000000000000000000000000000000000000ffff0000010000000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
|
||||
|
||||
["An ADD producing a 5-byte result that sets CTxIn::SEQUENCE_LOCKTIME_DISABLE_FLAG"],
|
||||
[[["0000000000000000000000000000000000000000000000000000000000000100", 0, "2147483647 65536 CHECKSEQUENCEVERIFY 1"]],
|
||||
"020000000100010000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
|
||||
"02000000010001000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
|
||||
[[["0000000000000000000000000000000000000000000000000000000000000100", 0, "2147483647 4259840 ADD CHECKSEQUENCEVERIFY 1"]],
|
||||
"020000000100010000000000000000000000000000000000000000000000000000000000000000000000000040000100000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
|
||||
"02000000010001000000000000000000000000000000000000000000000000000000000000000000000000004000010000000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
|
||||
|
||||
["Valid CHECKSEQUENCEVERIFY in scriptSig"],
|
||||
[[["0000000000000000000000000000000000000000000000000000000000000100", 0, "1"]],
|
||||
"02000000010001000000000000000000000000000000000000000000000000000000000000000000000251b2010000000100000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
|
||||
"02000000010001000000000000000000000000000000000000000000000000000000000000000000000251b201000000010000000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
|
||||
|
||||
["Valid CHECKSEQUENCEVERIFY in redeemScript"],
|
||||
[[["0000000000000000000000000000000000000000000000000000000000000100", 0, "HASH160 0x14 0x7c17aff532f22beb54069942f9bf567a66133eaf EQUAL"]],
|
||||
"0200000001000100000000000000000000000000000000000000000000000000000000000000000000030251b2010000000100000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
|
||||
"0200000001000100000000000000000000000000000000000000000000000000000000000000000000030251b201000000010000000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"],
|
||||
|
||||
["Valid P2WPKH (Private key of segwit tests is L5AQtV2HDm4xGsseLokK2VAT2EtYKcTm3c7HwqnJBFt9LdaQULsM)"],
|
||||
[[["0000000000000000000000000000000000000000000000000000000000000100", 0, "0x00 0x14 0x4c9c3dfac4207d5d8cb89df5722cb3d712385e3f", 1000]],
|
||||
|
||||
@ -21,6 +21,7 @@
|
||||
#include "test/test_bitcoin.h"
|
||||
|
||||
#include <memory>
|
||||
//#include <iostream>
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
@ -42,34 +43,40 @@ struct {
|
||||
unsigned char extranonce;
|
||||
unsigned int nonce;
|
||||
} blockinfo[] = {
|
||||
{4, 0xa4ad9f65}, {2, 0x15cf2b27}, {1, 0x037620ac}, {1, 0x700d9c54},
|
||||
{2, 0xce79f74f}, {2, 0x52d9c194}, {1, 0x77bc3efc}, {2, 0xbb62c5e8},
|
||||
{2, 0x83ff997a}, {1, 0x48b984ee}, {1, 0xef925da0}, {2, 0x680d2979},
|
||||
{2, 0x08953af7}, {1, 0x087dd553}, {2, 0x210e2818}, {2, 0xdfffcdef},
|
||||
{1, 0xeea1b209}, {2, 0xba4a8943}, {1, 0xa7333e77}, {1, 0x344f3e2a},
|
||||
{3, 0xd651f08e}, {2, 0xeca3957f}, {2, 0xca35aa49}, {1, 0x6bb2065d},
|
||||
{2, 0x0170ee44}, {1, 0x6e12f4aa}, {2, 0x43f4f4db}, {2, 0x279c1c44},
|
||||
{2, 0xb5a50f10}, {2, 0xb3902841}, {2, 0xd198647e}, {2, 0x6bc40d88},
|
||||
{1, 0x633a9a1c}, {2, 0x9a722ed8}, {2, 0x55580d10}, {1, 0xd65022a1},
|
||||
{2, 0xa12ffcc8}, {1, 0x75a6a9c7}, {2, 0xfb7c80b7}, {1, 0xe8403e6c},
|
||||
{1, 0xe34017a0}, {3, 0x659e177b}, {2, 0xba5c40bf}, {5, 0x022f11ef},
|
||||
{1, 0xa9ab516a}, {5, 0xd0999ed4}, {1, 0x37277cb3}, {1, 0x830f735f},
|
||||
{1, 0xc6e3d947}, {2, 0x824a0c1b}, {1, 0x99962416}, {1, 0x75336f63},
|
||||
{1, 0xaacf0fea}, {1, 0xd6531aec}, {5, 0x7afcf541}, {5, 0x9d6fac0d},
|
||||
{1, 0x4cf5c4df}, {1, 0xabe0f2a0}, {6, 0x4a3dac18}, {2, 0xf265febe},
|
||||
{2, 0x1bc9f23f}, {1, 0xad49ab71}, {1, 0x9f2d8923}, {1, 0x15acb65d},
|
||||
{2, 0xd1cecb52}, {2, 0xf856808b}, {1, 0x0fa96e29}, {1, 0xe063ecbc},
|
||||
{1, 0x78d926c6}, {5, 0x3e38ad35}, {5, 0x73901915}, {1, 0x63424be0},
|
||||
{1, 0x6d6b0a1d}, {2, 0x888ba681}, {2, 0xe96b0714}, {1, 0xb7fcaa55},
|
||||
{2, 0x19c106eb}, {1, 0x5aa13484}, {2, 0x5bf4c2f3}, {2, 0x94d401dd},
|
||||
{1, 0xa9bc23d9}, {1, 0x3a69c375}, {1, 0x56ed2006}, {5, 0x85ba6dbd},
|
||||
{1, 0xfd9b2000}, {1, 0x2b2be19a}, {1, 0xba724468}, {1, 0x717eb6e5},
|
||||
{1, 0x70de86d9}, {1, 0x74e23a42}, {1, 0x49e92832}, {2, 0x6926dbb9},
|
||||
{0, 0x64452497}, {1, 0x54306d6f}, {2, 0x97ebf052}, {2, 0x55198b70},
|
||||
{2, 0x03fe61f0}, {1, 0x98f9e67f}, {1, 0xc0842a09}, {1, 0xdfed39c5},
|
||||
{1, 0x3144223e}, {1, 0xb3d12f84}, {1, 0x7366ceb7}, {5, 0x6240691b},
|
||||
{2, 0xd3529b57}, {1, 0xf4cae3b1}, {1, 0x5b1df222}, {1, 0xa16a5c70},
|
||||
{2, 0xbbccedc6}, {2, 0xfe38d0ef},
|
||||
{4, 0x00449be3}, {2, 0x0007b5d4}, {1, 0x00277b25}, {1, 0x00554a73},
|
||||
{2, 0x000f50c3}, {2, 0x00058d80}, {1, 0x00087eb0}, {2, 0x0005533b},
|
||||
{2, 0x00160a2b}, {1, 0x00112185}, {1, 0x0008ef83}, {2, 0x000d744f},
|
||||
{2, 0x00023c4b}, {1, 0x001fb99c}, {2, 0x00097260}, {2, 0x000087f0},
|
||||
{1, 0x000ef006}, {2, 0x000a891e}, {1, 0x00146799}, {1, 0x00052fe5},
|
||||
{3, 0x000ccafb}, {2, 0x0004ed6e}, {2, 0x000670e2}, {1, 0x00032442},
|
||||
// {4, 0xa4ad9f65}, {2, 0x15cf2b27}, {1, 0x037620ac}, {1, 0x700d9c54},
|
||||
// {2, 0xce79f74f}, {2, 0x52d9c194}, {1, 0x77bc3efc}, {2, 0xbb62c5e8},
|
||||
// {2, 0x83ff997a}, {1, 0x48b984ee}, {1, 0xef925da0}, {2, 0x680d2979},
|
||||
// {2, 0x08953af7}, {1, 0x087dd553}, {2, 0x210e2818}, {2, 0xdfffcdef},
|
||||
// {1, 0xeea1b209}, {2, 0xba4a8943}, {1, 0xa7333e77}, {1, 0x344f3e2a},
|
||||
// {3, 0xd651f08e}, {2, 0xeca3957f}, {2, 0xca35aa49}, {1, 0x6bb2065d},
|
||||
// {2, 0x0170ee44}, {1, 0x6e12f4aa}, {2, 0x43f4f4db}, {2, 0x279c1c44},
|
||||
// {2, 0xb5a50f10}, {2, 0xb3902841}, {2, 0xd198647e}, {2, 0x6bc40d88},
|
||||
// {1, 0x633a9a1c}, {2, 0x9a722ed8}, {2, 0x55580d10}, {1, 0xd65022a1},
|
||||
// {2, 0xa12ffcc8}, {1, 0x75a6a9c7}, {2, 0xfb7c80b7}, {1, 0xe8403e6c},
|
||||
// {1, 0xe34017a0}, {3, 0x659e177b}, {2, 0xba5c40bf}, {5, 0x022f11ef},
|
||||
// {1, 0xa9ab516a}, {5, 0xd0999ed4}, {1, 0x37277cb3}, {1, 0x830f735f},
|
||||
// {1, 0xc6e3d947}, {2, 0x824a0c1b}, {1, 0x99962416}, {1, 0x75336f63},
|
||||
// {1, 0xaacf0fea}, {1, 0xd6531aec}, {5, 0x7afcf541}, {5, 0x9d6fac0d},
|
||||
// {1, 0x4cf5c4df}, {1, 0xabe0f2a0}, {6, 0x4a3dac18}, {2, 0xf265febe},
|
||||
// {2, 0x1bc9f23f}, {1, 0xad49ab71}, {1, 0x9f2d8923}, {1, 0x15acb65d},
|
||||
// {2, 0xd1cecb52}, {2, 0xf856808b}, {1, 0x0fa96e29}, {1, 0xe063ecbc},
|
||||
// {1, 0x78d926c6}, {5, 0x3e38ad35}, {5, 0x73901915}, {1, 0x63424be0},
|
||||
// {1, 0x6d6b0a1d}, {2, 0x888ba681}, {2, 0xe96b0714}, {1, 0xb7fcaa55},
|
||||
// {2, 0x19c106eb}, {1, 0x5aa13484}, {2, 0x5bf4c2f3}, {2, 0x94d401dd},
|
||||
// {1, 0xa9bc23d9}, {1, 0x3a69c375}, {1, 0x56ed2006}, {5, 0x85ba6dbd},
|
||||
// {1, 0xfd9b2000}, {1, 0x2b2be19a}, {1, 0xba724468}, {1, 0x717eb6e5},
|
||||
// {1, 0x70de86d9}, {1, 0x74e23a42}, {1, 0x49e92832}, {2, 0x6926dbb9},
|
||||
// {0, 0x64452497}, {1, 0x54306d6f}, {2, 0x97ebf052}, {2, 0x55198b70},
|
||||
// {2, 0x03fe61f0}, {1, 0x98f9e67f}, {1, 0xc0842a09}, {1, 0xdfed39c5},
|
||||
// {1, 0x3144223e}, {1, 0xb3d12f84}, {1, 0x7366ceb7}, {5, 0x6240691b},
|
||||
// {2, 0xd3529b57}, {1, 0xf4cae3b1}, {1, 0x5b1df222}, {1, 0xa16a5c70},
|
||||
// {2, 0xbbccedc6}, {2, 0xfe38d0ef},
|
||||
};
|
||||
|
||||
CBlockIndex CreateBlockIndex(int nHeight)
|
||||
@ -102,20 +109,23 @@ void TestPackageSelection(const CChainParams& chainparams, CScript scriptPubKey,
|
||||
tx.vin[0].prevout.hash = txFirst[0]->GetHash();
|
||||
tx.vin[0].prevout.n = 0;
|
||||
tx.vout.resize(1);
|
||||
tx.vout[0].nValue = 5000000000LL - 1000;
|
||||
// tx.vout[0].nValue = 5000000000LL - 1000;
|
||||
tx.vout[0].nValue = 10000000000LL - 1000;
|
||||
// This tx has a low fee: 1000 satoshis
|
||||
uint256 hashParentTx = tx.GetHash(); // save this txid for later use
|
||||
mempool.addUnchecked(hashParentTx, entry.Fee(1000).Time(GetTime()).SpendsCoinbase(true).FromTx(tx));
|
||||
|
||||
// This tx has a medium fee: 10000 satoshis
|
||||
tx.vin[0].prevout.hash = txFirst[1]->GetHash();
|
||||
tx.vout[0].nValue = 5000000000LL - 10000;
|
||||
// tx.vout[0].nValue = 5000000000LL - 10000;
|
||||
tx.vout[0].nValue = 10000000000LL - 10000;
|
||||
uint256 hashMediumFeeTx = tx.GetHash();
|
||||
mempool.addUnchecked(hashMediumFeeTx, entry.Fee(10000).Time(GetTime()).SpendsCoinbase(true).FromTx(tx));
|
||||
|
||||
// This tx has a high fee, but depends on the first transaction
|
||||
tx.vin[0].prevout.hash = hashParentTx;
|
||||
tx.vout[0].nValue = 5000000000LL - 1000 - 50000; // 50k satoshi fee
|
||||
// tx.vout[0].nValue = 5000000000LL - 1000 - 50000; // 50k satoshi fee
|
||||
tx.vout[0].nValue = 10000000000LL - 1000 - 50000; // 50k satoshi fee
|
||||
uint256 hashHighFeeTx = tx.GetHash();
|
||||
mempool.addUnchecked(hashHighFeeTx, entry.Fee(50000).Time(GetTime()).SpendsCoinbase(false).FromTx(tx));
|
||||
|
||||
@ -126,7 +136,8 @@ void TestPackageSelection(const CChainParams& chainparams, CScript scriptPubKey,
|
||||
|
||||
// Test that a package below the block min tx fee doesn't get included
|
||||
tx.vin[0].prevout.hash = hashHighFeeTx;
|
||||
tx.vout[0].nValue = 5000000000LL - 1000 - 50000; // 0 fee
|
||||
// tx.vout[0].nValue = 5000000000LL - 1000 - 50000; // 0 fee
|
||||
tx.vout[0].nValue = 10000000000LL - 1000 - 50000; // 0 fee
|
||||
uint256 hashFreeTx = tx.GetHash();
|
||||
mempool.addUnchecked(hashFreeTx, entry.Fee(0).FromTx(tx));
|
||||
size_t freeTxSize = ::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION);
|
||||
@ -136,7 +147,8 @@ void TestPackageSelection(const CChainParams& chainparams, CScript scriptPubKey,
|
||||
CAmount feeToUse = blockMinFeeRate.GetFee(2*freeTxSize) - 1;
|
||||
|
||||
tx.vin[0].prevout.hash = hashFreeTx;
|
||||
tx.vout[0].nValue = 5000000000LL - 1000 - 50000 - feeToUse;
|
||||
// tx.vout[0].nValue = 5000000000LL - 1000 - 50000 - feeToUse;
|
||||
tx.vout[0].nValue = 10000000000LL - 1000 - 50000 - feeToUse;
|
||||
uint256 hashLowFeeTx = tx.GetHash();
|
||||
mempool.addUnchecked(hashLowFeeTx, entry.Fee(feeToUse).FromTx(tx));
|
||||
pblocktemplate = AssemblerForTest(chainparams).CreateNewBlock(scriptPubKey);
|
||||
@ -235,7 +247,17 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
|
||||
txFirst.push_back(pblock->vtx[0]);
|
||||
pblock->hashMerkleRoot = BlockMerkleRoot(*pblock);
|
||||
pblock->nNonce = blockinfo[i].nonce;
|
||||
//mine new nonces
|
||||
|
||||
// std::chrono::steady_clock::time_point begin = std::chrono::steady_clock::now();
|
||||
// while (pblock->nNonce < 0xFFFFFFFF && !CheckProofOfWork(pblock->GetPoWHash(), pblock->nBits, Params().GetConsensus())) {
|
||||
// ++pblock->nNonce;
|
||||
// }
|
||||
// std::chrono::steady_clock::time_point end= std::chrono::steady_clock::now();
|
||||
// std::cout << "Time difference = " << std::chrono::duration_cast<std::chrono::microseconds>(end - begin).count() <<std::endl;
|
||||
// std::cout << "{" << blockinfo[i].extranonce << ", 0x" << std::hex << std::setw(8) << std::setfill('0') << pblock->nNonce << "}\n";
|
||||
std::shared_ptr<const CBlock> shared_pblock = std::make_shared<const CBlock>(*pblock);
|
||||
|
||||
BOOST_CHECK(ProcessNewBlock(chainparams, shared_pblock, true, nullptr));
|
||||
pblock->hashPrevBlock = pblock->GetHash();
|
||||
}
|
||||
@ -369,7 +391,7 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
|
||||
// subsidy changing
|
||||
int nHeight = chainActive.Height();
|
||||
// Create an actual 209999-long block chain (without valid blocks).
|
||||
while (chainActive.Tip()->nHeight < 839999) {
|
||||
while (chainActive.Tip()->nHeight < 799999) {
|
||||
CBlockIndex* prev = chainActive.Tip();
|
||||
CBlockIndex* next = new CBlockIndex();
|
||||
next->phashBlock = new uint256(InsecureRand256());
|
||||
@ -381,7 +403,7 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
|
||||
}
|
||||
BOOST_CHECK(pblocktemplate = AssemblerForTest(chainparams).CreateNewBlock(scriptPubKey));
|
||||
// Extend to a 210000-long block chain.
|
||||
while (chainActive.Tip()->nHeight < 840000) {
|
||||
while (chainActive.Tip()->nHeight < 800000) {
|
||||
CBlockIndex* prev = chainActive.Tip();
|
||||
CBlockIndex* next = new CBlockIndex();
|
||||
next->phashBlock = new uint256(InsecureRand256());
|
||||
|
||||
48
src/test/pow_tests.cpp
Normal file → Executable file
48
src/test/pow_tests.cpp
Normal file → Executable file
@ -17,48 +17,58 @@ BOOST_FIXTURE_TEST_SUITE(pow_tests, BasicTestingSetup)
|
||||
BOOST_AUTO_TEST_CASE(get_next_work)
|
||||
{
|
||||
const auto chainParams = CreateChainParams(CBaseChainParams::MAIN);
|
||||
int64_t nLastRetargetTime = 1358118740; // Block #278207
|
||||
// int64_t nLastRetargetTime = 1358118740; // Block #278207
|
||||
// CBlockIndex pindexLast;
|
||||
// pindexLast.nHeight = 280223;
|
||||
// pindexLast.nTime = 1358378777; // Block #280223
|
||||
// pindexLast.nBits = 0x1c0ac141;
|
||||
int64_t nLastRetargetTime = 1358118740; // Block #20000
|
||||
CBlockIndex pindexLast;
|
||||
pindexLast.nHeight = 280223;
|
||||
pindexLast.nTime = 1358378777; // Block #280223
|
||||
pindexLast.nBits = 0x1c0ac141;
|
||||
BOOST_CHECK_EQUAL(CalculateNextWorkRequired(&pindexLast, nLastRetargetTime, chainParams->GetConsensus()), 0x1c093f8d);
|
||||
pindexLast.nHeight = 21000;
|
||||
pindexLast.nTime = 1372362352; // Block #21000
|
||||
pindexLast.nBits = 0x1d078ab6;
|
||||
BOOST_CHECK_EQUAL(CalculateNextWorkRequired(&pindexLast, nLastRetargetTime, chainParams->GetConsensus()), 0x1D1E2AD8);
|
||||
}
|
||||
|
||||
/* Test the constraint on the upper bound for next work */
|
||||
BOOST_AUTO_TEST_CASE(get_next_work_pow_limit)
|
||||
{
|
||||
const auto chainParams = CreateChainParams(CBaseChainParams::MAIN);
|
||||
int64_t nLastRetargetTime = 1317972665; // Block #0
|
||||
// int64_t nLastRetargetTime = 1317972665; // Block #0
|
||||
// CBlockIndex pindexLast;
|
||||
// pindexLast.nHeight = 2015;
|
||||
// pindexLast.nTime = 1318480354; // Block #2015
|
||||
// pindexLast.nBits = 0x1e0ffff0;
|
||||
int64_t nLastRetargetTime = 1371488396; // Block #0
|
||||
CBlockIndex pindexLast;
|
||||
pindexLast.nHeight = 2015;
|
||||
pindexLast.nTime = 1318480354; // Block #2015
|
||||
pindexLast.nBits = 0x1e0ffff0;
|
||||
BOOST_CHECK_EQUAL(CalculateNextWorkRequired(&pindexLast, nLastRetargetTime, chainParams->GetConsensus()), 0x1e0fffff);
|
||||
pindexLast.nTime = 1371563039; // Block #2015
|
||||
pindexLast.nBits = 0x1d02686e;
|
||||
BOOST_CHECK_EQUAL(CalculateNextWorkRequired(&pindexLast, nLastRetargetTime, chainParams->GetConsensus()), 0x1D09A1B8);
|
||||
}
|
||||
|
||||
/* Test the constraint on the lower bound for actual time taken */
|
||||
BOOST_AUTO_TEST_CASE(get_next_work_lower_limit_actual)
|
||||
{
|
||||
const auto chainParams = CreateChainParams(CBaseChainParams::MAIN);
|
||||
int64_t nLastRetargetTime = 1401682934; // NOTE: Not an actual block time
|
||||
int64_t nLastRetargetTime = 1405978436; // Block #600000
|
||||
CBlockIndex pindexLast;
|
||||
pindexLast.nHeight = 578591;
|
||||
pindexLast.nTime = 1401757934; // Block #578591
|
||||
pindexLast.nBits = 0x1b075cf1;
|
||||
BOOST_CHECK_EQUAL(CalculateNextWorkRequired(&pindexLast, nLastRetargetTime, chainParams->GetConsensus()), 0x1b01d73c);
|
||||
pindexLast.nHeight = 600030;
|
||||
pindexLast.nTime = 1405979702; // Block #600030
|
||||
pindexLast.nBits = 0x1d00a23e;
|
||||
BOOST_CHECK_EQUAL(CalculateNextWorkRequired(&pindexLast, nLastRetargetTime, chainParams->GetConsensus()), 0x1D00A6F9);
|
||||
}
|
||||
|
||||
/* Test the constraint on the upper bound for actual time taken */
|
||||
BOOST_AUTO_TEST_CASE(get_next_work_upper_limit_actual)
|
||||
{
|
||||
const auto chainParams = CreateChainParams(CBaseChainParams::MAIN);
|
||||
int64_t nLastRetargetTime = 1463690315; // NOTE: Not an actual block time
|
||||
int64_t nLastRetargetTime = 1342177393; // NOTE: Not an actual block time
|
||||
CBlockIndex pindexLast;
|
||||
pindexLast.nHeight = 1001951;
|
||||
pindexLast.nTime = 1464900315; // Block #46367
|
||||
pindexLast.nBits = 0x1b015318;
|
||||
BOOST_CHECK_EQUAL(CalculateNextWorkRequired(&pindexLast, nLastRetargetTime, chainParams->GetConsensus()), 0x1b054c60);
|
||||
pindexLast.nHeight = 102000;
|
||||
pindexLast.nTime = 1375677393; // Block #102000
|
||||
pindexLast.nBits = 0x1d042d4e;
|
||||
BOOST_CHECK_EQUAL(CalculateNextWorkRequired(&pindexLast, nLastRetargetTime, chainParams->GetConsensus()), 0x1D10B538);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(GetBlockProofEquivalentTime_test)
|
||||
|
||||
6
src/test/rpc_tests.cpp
Normal file → Executable file
6
src/test/rpc_tests.cpp
Normal file → Executable file
@ -113,10 +113,10 @@ BOOST_AUTO_TEST_CASE(rpc_rawsign)
|
||||
"\"vout\":1,\"scriptPubKey\":\"a914b10c9df5f7edf436c697f02f1efdba4cf399615187\","
|
||||
"\"redeemScript\":\"512103debedc17b3df2badbcdd86d5feb4562b86fe182e5998abd8bcd4f122c6155b1b21027e940bb73ab8732bfdf7f9216ecefca5b94d6df834e77e108f68e66f126044c052ae\"}]";
|
||||
r = CallRPC(std::string("createrawtransaction ")+prevout+" "+
|
||||
"{\"3HqAe9LtNBjnsfM4CyYaWTnvCaUYT7v4oZ\":11}");
|
||||
"{\"FMyGBQHXfbe5QfXewZY94DxX5iCqod1Hsm\":11}");
|
||||
std::string notsigned = r.get_str();
|
||||
std::string privkey1 = "\"T6hoRM7L8u4f9vHd4eGMAmwV6AMCE11PvYi7YjrdegG223kw64r1\"";
|
||||
std::string privkey2 = "\"T5Xu6pe5iqQYqXGxhcY2QEFr7NNoVQ5R6A4abpswunCTF9w85g8V\"";
|
||||
std::string privkey1 = "\"RBAbzFRdru9sVC7dsf8jpWi9rWjiNZUwoocRGqMQGTTmMk6uFJgi\""; //6cf864daeb6a276e7bc66466ec624d7e1ca9c5be11155399f37ce7a9f819b64101
|
||||
std::string privkey2 = "\"R9zhfixPSqVmAo6yWdQR3y2WsimKdxYxyQxtKvNiXZQCarJsWR8Y\""; //4a09f53de410732e5e6e82deca3498bf58d23ee079e70b1c06b3cae26bf34d5301
|
||||
r = CallRPC(std::string("signrawtransaction ")+notsigned+" "+prevout+" "+"[]");
|
||||
BOOST_CHECK(find_value(r.get_obj(), "complete").get_bool() == false);
|
||||
r = CallRPC(std::string("signrawtransaction ")+notsigned+" "+prevout+" "+"["+privkey1+","+privkey2+"]");
|
||||
|
||||
0
src/test/transaction_tests.cpp
Normal file → Executable file
0
src/test/transaction_tests.cpp
Normal file → Executable file
Loading…
Reference in New Issue
Block a user