Changeset View
Changeset View
Standalone View
Standalone View
src/test/sighash_tests.cpp
// Copyright (c) 2013-2016 The Bitcoin Core developers | // Copyright (c) 2013-2016 The Bitcoin Core developers | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
#include "consensus/tx_verify.h" | #include <consensus/tx_verify.h> | ||||
#include "consensus/validation.h" | #include <consensus/validation.h> | ||||
#include "data/sighash.json.h" | #include <data/sighash.json.h> | ||||
#include "hash.h" | #include <hash.h> | ||||
#include "script/interpreter.h" | #include <script/interpreter.h> | ||||
#include "script/script.h" | #include <script/script.h> | ||||
#include "serialize.h" | #include <serialize.h> | ||||
#include "streams.h" | #include <streams.h> | ||||
#include "test/jsonutil.h" | #include <util.h> | ||||
#include "test/test_bitcoin.h" | #include <utilstrencodings.h> | ||||
#include "util.h" | #include <version.h> | ||||
#include "utilstrencodings.h" | |||||
#include "version.h" | |||||
#include <iostream> | #include <test/jsonutil.h> | ||||
#include <test/test_bitcoin.h> | |||||
#include <boost/test/unit_test.hpp> | #include <boost/test/unit_test.hpp> | ||||
#include <univalue.h> | #include <univalue.h> | ||||
#include <iostream> | |||||
// Old script.cpp SignatureHash function | // Old script.cpp SignatureHash function | ||||
static uint256 SignatureHashOld(CScript scriptCode, const CTransaction &txTo, | static uint256 SignatureHashOld(CScript scriptCode, const CTransaction &txTo, | ||||
unsigned int nIn, uint32_t nHashType) { | unsigned int nIn, uint32_t nHashType) { | ||||
static const uint256 one(uint256S( | static const uint256 one(uint256S( | ||||
"0000000000000000000000000000000000000000000000000000000000000001")); | "0000000000000000000000000000000000000000000000000000000000000001")); | ||||
if (nIn >= txTo.vin.size()) { | if (nIn >= txTo.vin.size()) { | ||||
printf("ERROR: SignatureHash(): nIn=%d out of range\n", nIn); | printf("ERROR: SignatureHash(): nIn=%d out of range\n", nIn); | ||||
return one; | return one; | ||||
▲ Show 20 Lines • Show All 249 Lines • Show Last 20 Lines |