aboutsummaryrefslogtreecommitdiff
path: root/src/main.h
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2014-11-29 16:01:37 +0100
committerPieter Wuille <pieter.wuille@gmail.com>2014-12-02 22:05:03 +0100
commit307f7d48d4733da016bf73676f6ebff9144365c1 (patch)
treebfab8c627703636f0b8f6d37147f8d2c0b0e427c /src/main.h
parent0286fe5b3be20d0c27c6a71fa1a222166bccfd65 (diff)
downloadbitcoin-307f7d48d4733da016bf73676f6ebff9144365c1.tar.xz
Report script evaluation failures in log and reject messages
Diffstat (limited to 'src/main.h')
-rw-r--r--src/main.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/main.h b/src/main.h
index caf8331ee1..b04692bb54 100644
--- a/src/main.h
+++ b/src/main.h
@@ -96,6 +96,8 @@ static const unsigned int MAX_HEADERS_RESULTS = 2000;
static const unsigned int BLOCK_DOWNLOAD_WINDOW = 1024;
/** Time to wait (in seconds) between writing blockchain state to disk. */
static const unsigned int DATABASE_WRITE_INTERVAL = 3600;
+/** Maximum length of reject messages. */
+static const unsigned int MAX_REJECT_MESSAGE_LENGTH = 111;
/** "reject" message codes **/
static const unsigned char REJECT_MALFORMED = 0x01;
@@ -325,14 +327,15 @@ private:
unsigned int nIn;
unsigned int nFlags;
bool cacheStore;
+ ScriptError error;
public:
- CScriptCheck(): ptxTo(0), nIn(0), nFlags(0), cacheStore(false) {}
+ CScriptCheck(): ptxTo(0), nIn(0), nFlags(0), cacheStore(false), error(SCRIPT_ERR_UNKNOWN_ERROR) {}
CScriptCheck(const CCoins& txFromIn, const CTransaction& txToIn, unsigned int nInIn, unsigned int nFlagsIn, bool cacheIn) :
scriptPubKey(txFromIn.vout[txToIn.vin[nInIn].prevout.n].scriptPubKey),
- ptxTo(&txToIn), nIn(nInIn), nFlags(nFlagsIn), cacheStore(cacheIn) { }
+ ptxTo(&txToIn), nIn(nInIn), nFlags(nFlagsIn), cacheStore(cacheIn), error(SCRIPT_ERR_UNKNOWN_ERROR) { }
- bool operator()() const;
+ bool operator()();
void swap(CScriptCheck &check) {
scriptPubKey.swap(check.scriptPubKey);
@@ -340,7 +343,10 @@ public:
std::swap(nIn, check.nIn);
std::swap(nFlags, check.nFlags);
std::swap(cacheStore, check.cacheStore);
+ std::swap(error, check.error);
}
+
+ ScriptError GetScriptError() const { return error; }
};
/** Data structure that represents a partial merkle tree.