aboutsummaryrefslogtreecommitdiff
path: root/src/script/sign.cpp
diff options
context:
space:
mode:
authorPieter Wuille <[email protected]>2015-05-01 15:21:06 +0200
committerMatt Corallo <[email protected]>2015-06-11 01:03:23 -0700
commit9b4e7d9a5ec0f69c175d23dc9c94ed723147cf45 (patch)
treec03c9ea3ca882d8302e3f7029437de8b9670ef75 /src/script/sign.cpp
parentMerge pull request #6061 (diff)
downloaddiscoin-9b4e7d9a5ec0f69c175d23dc9c94ed723147cf45.tar.xz
discoin-9b4e7d9a5ec0f69c175d23dc9c94ed723147cf45.zip
Add DummySignatureCreator which just creates zeroed sigs
Diffstat (limited to 'src/script/sign.cpp')
-rw-r--r--src/script/sign.cpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/script/sign.cpp b/src/script/sign.cpp
index eab629cd9..4543ca303 100644
--- a/src/script/sign.cpp
+++ b/src/script/sign.cpp
@@ -275,3 +275,39 @@ CScript CombineSignatures(const CScript& scriptPubKey, const BaseSignatureChecke
return CombineSignatures(scriptPubKey, checker, txType, vSolutions, stack1, stack2);
}
+
+namespace {
+/** Dummy signature checker which accepts all signatures. */
+class DummySignatureChecker : public BaseSignatureChecker
+{
+public:
+ DummySignatureChecker() {}
+
+ bool CheckSig(const std::vector<unsigned char>& scriptSig, const std::vector<unsigned char>& vchPubKey, const CScript& scriptCode) const
+ {
+ return true;
+ }
+};
+const DummySignatureChecker dummyChecker;
+}
+
+const BaseSignatureChecker& DummySignatureCreator::Checker() const
+{
+ return dummyChecker;
+}
+
+bool DummySignatureCreator::CreateSig(std::vector<unsigned char>& vchSig, const CKeyID& keyid, const CScript& scriptCode) const
+{
+ // Create a dummy signature that is a valid DER-encoding
+ vchSig.assign(72, '\000');
+ vchSig[0] = 0x30;
+ vchSig[1] = 69;
+ vchSig[2] = 0x02;
+ vchSig[3] = 33;
+ vchSig[4] = 0x01;
+ vchSig[4 + 33] = 0x02;
+ vchSig[5 + 33] = 32;
+ vchSig[6 + 33] = 0x01;
+ vchSig[6 + 33 + 32] = SIGHASH_ALL;
+ return true;
+}