diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2014-12-04 16:41:41 +0100 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2014-12-04 16:43:35 +0100 |
commit | 9ddc8c63ab72a6951f0c4f636b3252a43193a45b (patch) | |
tree | 78249812bab44488ed49adfa0a2f33c45ff646bf /src/main.h | |
parent | 4d2ecc4f943fd70892ffd49c3059c62a0e1feb72 (diff) | |
parent | 307f7d48d4733da016bf73676f6ebff9144365c1 (diff) |
Merge pull request #5394
307f7d4 Report script evaluation failures in log and reject messages (Pieter Wuille)
Diffstat (limited to 'src/main.h')
-rw-r--r-- | src/main.h | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/main.h b/src/main.h index fc9913b7c6..f3d30fafb3 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; @@ -334,14 +336,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); @@ -349,7 +352,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. |