Permalink
Browse files

remove libsnappy detection from leveldb 1.20

and use chashwriter for signing
  • Loading branch information...
justinvforvendetta committed Jul 4, 2018
1 parent 4d411de commit 20015c4cd895ecabc1bf6f5d10454b71f4db70e0
Showing with 6 additions and 7 deletions.
  1. +4 −4 src/rpcwallet.cpp
  2. +2 −3 src/script.cpp
@@ -393,12 +393,12 @@ Value signmessage(const Array& params, bool fHelp)
if (!pwalletMain->GetKey(keyID, key))
throw JSONRPCError(RPC_WALLET_ERROR, "Private key not available");
CDataStream ss(SER_GETHASH, 0);
CHashWriter ss(SER_GETHASH, 0);
ss << strMessageMagic;
ss << strMessage;
vector<unsigned char> vchSig;
if (!key.SignCompact(Hash(ss.begin(), ss.end()), vchSig))
if (!key.SignCompact(ss.GetHash(), vchSig))
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Sign failed");
return EncodeBase64(&vchSig[0], vchSig.size());
@@ -429,12 +429,12 @@ Value verifymessage(const Array& params, bool fHelp)
if (fInvalid)
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Malformed base64 encoding");
CDataStream ss(SER_GETHASH, 0);
CHashWriter ss(SER_GETHASH, 0);
ss << strMessageMagic;
ss << strMessage;
CKey key;
if (!key.SetCompactSignature(Hash(ss.begin(), ss.end()), vchSig))
if (!key.SetCompactSignature(ss.GetHash(), vchSig))
return false;
return (key.GetPubKey().GetID() == keyID);
@@ -1176,10 +1176,9 @@ uint256 SignatureHash(CScript scriptCode, const CTransaction& txTo, unsigned int
}
// Serialize and hash
CDataStream ss(SER_GETHASH, 0);
ss.reserve(10000);
CHashWriter ss(SER_GETHASH, 0);
ss << txTmp << nHashType;
return Hash(ss.begin(), ss.end());
return ss.GetHash();
}

0 comments on commit 20015c4

Please sign in to comment.