update script section
This commit is contained in:
@@ -3,12 +3,12 @@
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include "bitcoinconsensus.h"
|
||||
#include <script/bitcoinconsensus.h>
|
||||
|
||||
#include "primitives/transaction.h"
|
||||
#include "pubkey.h"
|
||||
#include "script/interpreter.h"
|
||||
#include "version.h"
|
||||
#include <primitives/transaction.h>
|
||||
#include <pubkey.h>
|
||||
#include <script/interpreter.h>
|
||||
#include <version.h>
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -28,10 +28,10 @@ public:
|
||||
if (nSize > m_remaining)
|
||||
throw std::ios_base::failure(std::string(__func__) + ": end of data");
|
||||
|
||||
if (pch == NULL)
|
||||
if (pch == nullptr)
|
||||
throw std::ios_base::failure(std::string(__func__) + ": bad destination buffer");
|
||||
|
||||
if (m_data == NULL)
|
||||
if (m_data == nullptr)
|
||||
throw std::ios_base::failure(std::string(__func__) + ": bad source buffer");
|
||||
|
||||
memcpy(pch, m_data, nSize);
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include <stdint.h>
|
||||
|
||||
#if defined(BUILD_BITCOIN_INTERNAL) && defined(HAVE_CONFIG_H)
|
||||
#include "config/bitcoin-config.h"
|
||||
#include <config/bitcoin-config.h>
|
||||
#if defined(_WIN32)
|
||||
#if defined(DLL_EXPORT)
|
||||
#if defined(HAVE_FUNC_ATTRIBUTE_DLLEXPORT)
|
||||
@@ -52,9 +52,9 @@ enum
|
||||
bitcoinconsensus_SCRIPT_FLAGS_VERIFY_DERSIG = (1U << 2), // enforce strict DER (BIP66) compliance
|
||||
bitcoinconsensus_SCRIPT_FLAGS_VERIFY_CHECKLOCKTIMEVERIFY = (1U << 9), // enable CHECKLOCKTIMEVERIFY (BIP65)
|
||||
bitcoinconsensus_SCRIPT_FLAGS_VERIFY_ALL =
|
||||
bitcoinconsensus_SCRIPT_FLAGS_VERIFY_P2SH |
|
||||
bitcoinconsensus_SCRIPT_FLAGS_VERIFY_DERSIG |
|
||||
bitcoinconsensus_SCRIPT_FLAGS_VERIFY_CHECKLOCKTIMEVERIFY,
|
||||
bitcoinconsensus_SCRIPT_FLAGS_VERIFY_P2SH |
|
||||
bitcoinconsensus_SCRIPT_FLAGS_VERIFY_DERSIG |
|
||||
bitcoinconsensus_SCRIPT_FLAGS_VERIFY_CHECKLOCKTIMEVERIFY,
|
||||
};
|
||||
|
||||
/// Returns 1 if the input nIn of the serialized transaction pointed to by
|
||||
|
||||
@@ -3,15 +3,15 @@
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include "interpreter.h"
|
||||
#include <script/interpreter.h>
|
||||
|
||||
#include "primitives/transaction.h"
|
||||
#include "crypto/ripemd160.h"
|
||||
#include "crypto/sha1.h"
|
||||
#include "crypto/sha256.h"
|
||||
#include "pubkey.h"
|
||||
#include "script/script.h"
|
||||
#include "uint256.h"
|
||||
#include <primitives/transaction.h>
|
||||
#include <crypto/ripemd160.h>
|
||||
#include <crypto/sha1.h>
|
||||
#include <crypto/sha256.h>
|
||||
#include <pubkey.h>
|
||||
#include <script/script.h>
|
||||
#include <uint256.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
@@ -102,7 +102,7 @@ bool static IsCompressedPubKey(const valtype &vchPubKey) {
|
||||
* Where R and S are not negative (their first byte has its highest bit not set), and not
|
||||
* excessively padded (do not start with a 0 byte, unless an otherwise negative number follows,
|
||||
* in which case a single 0 byte is necessary and even required).
|
||||
*
|
||||
*
|
||||
* See https://bitcointalk.org/index.php?topic=8392.msg127623#msg127623
|
||||
*
|
||||
* This function is consensus-critical since BIP66.
|
||||
@@ -871,7 +871,7 @@ bool EvalScript(vector<vector<unsigned char> >& stack, const CScript& script, un
|
||||
popstack(stack);
|
||||
stack.push_back(vchHash);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case OP_CODESEPARATOR:
|
||||
{
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
#ifndef BITCOIN_SCRIPT_INTERPRETER_H
|
||||
#define BITCOIN_SCRIPT_INTERPRETER_H
|
||||
|
||||
#include "script_error.h"
|
||||
#include "primitives/transaction.h"
|
||||
#include <script/script_error.h>
|
||||
#include <primitives/transaction.h>
|
||||
|
||||
#include <vector>
|
||||
#include <stdint.h>
|
||||
|
||||
@@ -3,15 +3,14 @@
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include "ismine.h"
|
||||
#include <script/ismine.h>
|
||||
|
||||
#include "key.h"
|
||||
#include "keystore.h"
|
||||
#include "script/script.h"
|
||||
#include "script/standard.h"
|
||||
#include "script/sign.h"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
#include <base58.h>
|
||||
#include <key.h>
|
||||
#include <keystore.h>
|
||||
#include <script/script.h>
|
||||
#include <script/standard.h>
|
||||
#include <script/sign.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
@@ -20,7 +19,7 @@ typedef vector<unsigned char> valtype;
|
||||
unsigned int HaveKeys(const vector<valtype>& pubkeys, const CKeyStore& keystore)
|
||||
{
|
||||
unsigned int nResult = 0;
|
||||
BOOST_FOREACH(const valtype& pubkey, pubkeys)
|
||||
for(const valtype& pubkey: pubkeys)
|
||||
{
|
||||
CKeyID keyID = CPubKey(pubkey).GetID();
|
||||
if (keystore.HaveKey(keyID))
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#ifndef BITCOIN_SCRIPT_ISMINE_H
|
||||
#define BITCOIN_SCRIPT_ISMINE_H
|
||||
|
||||
#include "script/standard.h"
|
||||
#include <script/standard.h>
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include "script.h"
|
||||
#include <script/script.h>
|
||||
|
||||
#include "tinyformat.h"
|
||||
#include "utilstrencodings.h"
|
||||
#include <tinyformat.h>
|
||||
#include <utilstrencodings.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
@@ -6,8 +6,11 @@
|
||||
#ifndef BITCOIN_SCRIPT_SCRIPT_H
|
||||
#define BITCOIN_SCRIPT_SCRIPT_H
|
||||
|
||||
#include "crypto/common.h"
|
||||
#include "prevector.h"
|
||||
#include <crypto/common.h>
|
||||
#include <prevector.h>
|
||||
#include <pubkey.h>
|
||||
#include <uint256.h>
|
||||
#include <utilstrencodings.h>
|
||||
|
||||
#include <assert.h>
|
||||
#include <climits>
|
||||
@@ -649,4 +652,6 @@ public:
|
||||
virtual ~CReserveScript() {}
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif // BITCOIN_SCRIPT_SCRIPT_H
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include "script_error.h"
|
||||
#include <script/script_error.h>
|
||||
|
||||
const char* ScriptErrorString(const ScriptError serror)
|
||||
{
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include "sigcache.h"
|
||||
#include <script/sigcache.h>
|
||||
|
||||
#include "memusage.h"
|
||||
#include "pubkey.h"
|
||||
#include "random.h"
|
||||
#include "uint256.h"
|
||||
#include "util.h"
|
||||
#include <memusage.h>
|
||||
#include <pubkey.h>
|
||||
#include <random.h>
|
||||
#include <uint256.h>
|
||||
#include <util.h>
|
||||
|
||||
#include <boost/thread.hpp>
|
||||
#include <boost/unordered_set.hpp>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#ifndef BITCOIN_SCRIPT_SIGCACHE_H
|
||||
#define BITCOIN_SCRIPT_SIGCACHE_H
|
||||
|
||||
#include "script/interpreter.h"
|
||||
#include <script/interpreter.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
|
||||
@@ -3,16 +3,14 @@
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include "script/sign.h"
|
||||
#include <script/sign.h>
|
||||
|
||||
#include "key.h"
|
||||
#include "keystore.h"
|
||||
#include "policy/policy.h"
|
||||
#include "primitives/transaction.h"
|
||||
#include "script/standard.h"
|
||||
#include "uint256.h"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
#include <key.h>
|
||||
#include <keystore.h>
|
||||
#include <policy/policy.h>
|
||||
#include <primitives/transaction.h>
|
||||
#include <script/standard.h>
|
||||
#include <uint256.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
@@ -112,7 +110,7 @@ static bool SignStep(const BaseSignatureCreator& creator, const CScript& scriptP
|
||||
static CScript PushAll(const vector<valtype>& values)
|
||||
{
|
||||
CScript result;
|
||||
BOOST_FOREACH(const valtype& v, values) {
|
||||
for(const valtype& v: values) {
|
||||
if (v.size() == 0) {
|
||||
result << OP_0;
|
||||
} else if (v.size() == 1 && v[0] >= 1 && v[0] <= 16) {
|
||||
@@ -192,12 +190,12 @@ static vector<valtype> CombineMultisig(const CScript& scriptPubKey, const BaseSi
|
||||
{
|
||||
// Combine all the signatures we've got:
|
||||
set<valtype> allsigs;
|
||||
BOOST_FOREACH(const valtype& v, sigs1)
|
||||
for(const valtype& v: sigs1)
|
||||
{
|
||||
if (!v.empty())
|
||||
allsigs.insert(v);
|
||||
}
|
||||
BOOST_FOREACH(const valtype& v, sigs2)
|
||||
for(const valtype& v: sigs2)
|
||||
{
|
||||
if (!v.empty())
|
||||
allsigs.insert(v);
|
||||
@@ -208,7 +206,7 @@ static vector<valtype> CombineMultisig(const CScript& scriptPubKey, const BaseSi
|
||||
unsigned int nSigsRequired = vSolutions.front()[0];
|
||||
unsigned int nPubKeys = vSolutions.size()-2;
|
||||
map<valtype, valtype> sigs;
|
||||
BOOST_FOREACH(const valtype& sig, allsigs)
|
||||
for(const valtype& sig: allsigs)
|
||||
{
|
||||
for (unsigned int i = 0; i < nPubKeys; i++)
|
||||
{
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#ifndef BITCOIN_SCRIPT_SIGN_H
|
||||
#define BITCOIN_SCRIPT_SIGN_H
|
||||
|
||||
#include "script/interpreter.h"
|
||||
#include <script/interpreter.h>
|
||||
|
||||
class CKeyID;
|
||||
class CKeyStore;
|
||||
|
||||
@@ -3,14 +3,13 @@
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include "script/standard.h"
|
||||
#include <script/standard.h>
|
||||
|
||||
#include "pubkey.h"
|
||||
#include "script/script.h"
|
||||
#include "util.h"
|
||||
#include "utilstrencodings.h"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
#include <pubkey.h>
|
||||
#include <script/script.h>
|
||||
#include <script/sign.h>
|
||||
#include <util.h>
|
||||
#include <utilstrencodings.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
@@ -32,7 +31,7 @@ const char* GetTxnOutputType(txnouttype t)
|
||||
case TX_MULTISIG: return "multisig";
|
||||
case TX_NULL_DATA: return "nulldata";
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -47,7 +46,7 @@ bool Solver(const CScript& scriptPubKey, txnouttype& typeRet, vector<vector<unsi
|
||||
// Standard tx, sender provides pubkey, receiver adds signature
|
||||
mTemplates.insert(make_pair(TX_PUBKEY, CScript() << OP_PUBKEY << OP_CHECKSIG));
|
||||
|
||||
// Bitcoin address tx, sender provides hash of pubkey, receiver provides signature and pubkey
|
||||
// Blackcoin address tx, sender provides hash of pubkey, receiver provides signature and pubkey
|
||||
mTemplates.insert(make_pair(TX_PUBKEYHASH, CScript() << OP_DUP << OP_HASH160 << OP_PUBKEYHASH << OP_EQUALVERIFY << OP_CHECKSIG));
|
||||
|
||||
// Sender provides N pubkeys, receivers provides M signatures
|
||||
@@ -78,7 +77,7 @@ bool Solver(const CScript& scriptPubKey, txnouttype& typeRet, vector<vector<unsi
|
||||
|
||||
// Scan templates
|
||||
const CScript& script1 = scriptPubKey;
|
||||
BOOST_FOREACH(const PAIRTYPE(txnouttype, CScript)& tplate, mTemplates)
|
||||
for(const PAIRTYPE(txnouttype, CScript)& tplate: mTemplates)
|
||||
{
|
||||
const CScript& script2 = tplate.second;
|
||||
vSolutionsRet.clear();
|
||||
@@ -165,6 +164,7 @@ bool ExtractDestination(const CScript& scriptPubKey, CTxDestination& addressRet)
|
||||
{
|
||||
vector<valtype> vSolutions;
|
||||
txnouttype whichType;
|
||||
|
||||
if (!Solver(scriptPubKey, whichType, vSolutions))
|
||||
return false;
|
||||
|
||||
@@ -196,6 +196,7 @@ bool ExtractDestinations(const CScript& scriptPubKey, txnouttype& typeRet, vecto
|
||||
addressRet.clear();
|
||||
typeRet = TX_NONSTANDARD;
|
||||
vector<valtype> vSolutions;
|
||||
|
||||
if (!Solver(scriptPubKey, typeRet, vSolutions))
|
||||
return false;
|
||||
if (typeRet == TX_NULL_DATA){
|
||||
@@ -277,7 +278,7 @@ CScript GetScriptForMultisig(int nRequired, const std::vector<CPubKey>& keys)
|
||||
CScript script;
|
||||
|
||||
script << CScript::EncodeOP_N(nRequired);
|
||||
BOOST_FOREACH(const CPubKey& key, keys)
|
||||
for(const CPubKey& key: keys)
|
||||
script << ToByteVector(key);
|
||||
script << CScript::EncodeOP_N(keys.size()) << OP_CHECKMULTISIG;
|
||||
return script;
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
#ifndef BITCOIN_SCRIPT_STANDARD_H
|
||||
#define BITCOIN_SCRIPT_STANDARD_H
|
||||
|
||||
#include "script/interpreter.h"
|
||||
#include "uint256.h"
|
||||
#include <script/interpreter.h>
|
||||
#include <uint256.h>
|
||||
|
||||
#include <boost/variant.hpp>
|
||||
|
||||
@@ -36,16 +36,16 @@ extern unsigned nMaxDatacarrierBytes;
|
||||
* them to be valid. (but old blocks may not comply with) Currently just P2SH,
|
||||
* but in the future other flags may be added, such as a soft-fork to enforce
|
||||
* strict DER encoding.
|
||||
*
|
||||
*
|
||||
* Failing one of these tests may trigger a DoS ban - see CheckInputs() for
|
||||
* details.
|
||||
*/
|
||||
static const unsigned int MANDATORY_SCRIPT_VERIFY_FLAGS = SCRIPT_VERIFY_P2SH |
|
||||
SCRIPT_VERIFY_DERKEY |
|
||||
SCRIPT_VERIFY_LOW_S |
|
||||
SCRIPT_VERIFY_NULLDUMMY |
|
||||
SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY |
|
||||
SCRIPT_VERIFY_DERSIG;
|
||||
SCRIPT_VERIFY_DERKEY |
|
||||
SCRIPT_VERIFY_LOW_S |
|
||||
SCRIPT_VERIFY_NULLDUMMY |
|
||||
SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY |
|
||||
SCRIPT_VERIFY_DERSIG;
|
||||
|
||||
enum txnouttype
|
||||
{
|
||||
@@ -64,12 +64,12 @@ public:
|
||||
friend bool operator<(const CNoDestination &a, const CNoDestination &b) { return true; }
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* A txout script template with a specific destination. It is either:
|
||||
* * CNoDestination: no destination set
|
||||
* * CKeyID: TX_PUBKEYHASH destination
|
||||
* * CScriptID: TX_SCRIPTHASH destination
|
||||
* A CTxDestination is the internal data type encoded in a bitcoin address
|
||||
* A CTxDestination is the internal data type encoded in a blackcoin address
|
||||
*/
|
||||
typedef boost::variant<CNoDestination, CKeyID, CScriptID> CTxDestination;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user