diff options
| author | Gavin Andresen <[email protected]> | 2011-10-03 13:05:43 -0400 |
|---|---|---|
| committer | Gavin Andresen <[email protected]> | 2011-12-19 12:40:19 -0500 |
| commit | e679ec969c8b22c676ebb10bea1038f6c8f13b33 (patch) | |
| tree | c584f1a152c376ca0df93261d447c5b719449508 /src/base58.h | |
| parent | Global fixture to send output to console instead of debug.log (diff) | |
| download | discoin-e679ec969c8b22c676ebb10bea1038f6c8f13b33.tar.xz discoin-e679ec969c8b22c676ebb10bea1038f6c8f13b33.zip | |
OP_EVAL implementation
OP_EVAL is a new opcode that evaluates an item on the stack as a script.
It enables a new type of bitcoin address that needs an arbitrarily
complex script to redeem.
Diffstat (limited to 'src/base58.h')
| -rw-r--r-- | src/base58.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/base58.h b/src/base58.h index 113fa14a5..8fc546c50 100644 --- a/src/base58.h +++ b/src/base58.h @@ -268,6 +268,12 @@ public: SetHash160(Hash160(vchPubKey)); } + bool SetScriptHash160(const uint160& hash160) + { + SetData(fTestNet ? 112 : 1, &hash160, 20); + return true; + } + bool IsValid() const { int nExpectedSize = 20; @@ -275,9 +281,20 @@ public: switch(nVersion) { case 0: + nExpectedSize = 20; // Hash of public key + fExpectTestNet = false; + break; + case 1: + nExpectedSize = 20; // OP_EVAL, hash of CScript + fExpectTestNet = false; break; case 111: + nExpectedSize = 20; + fExpectTestNet = true; + break; + case 112: + nExpectedSize = 20; fExpectTestNet = true; break; @@ -286,6 +303,14 @@ public: } return fExpectTestNet == fTestNet && vchData.size() == nExpectedSize; } + bool IsScript() const + { + if (!IsValid()) + return false; + if (fTestNet) + return nVersion == 112; + return nVersion == 1; + } CBitcoinAddress() { |