[Dev] Documenting Feathercoin Specific Software settings - Part 8
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Add debug dialog : - commit
https://github.com/FeatherCoin/Feathercoin/commit/53644b506ce7b817a4135633184bd3d678b390d5
debug dialog
src/qt/walletframe.cpp
+ void WalletFrame::debugClicked() + { + WalletView *walletView = currentWalletView(); + if (walletView) + walletView->debugClicked(); + } +
Code added
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Add debug dialog : - commit
https://github.com/FeatherCoin/Feathercoin/commit/53644b506ce7b817a4135633184bd3d678b390d5
debug dialog
src/qt/walletframe.h
+ /** Open Debug dialog **/ + void debugClicked();
Code added
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Add debug dialog : - commit
https://github.com/FeatherCoin/Feathercoin/commit/53644b506ce7b817a4135633184bd3d678b390d5
debug dialog
src/qt/walletmodel.cpp
+ LogPrintf("StealthSecret send start....\n");
Logprintf added
+ if (true) + { + LogPrintf("ephem_secret.e[0]=%s \n",ephem_secret.e[0]); //secret + LogPrintf("sxAddr.scan_pubkey= %s\n", HexStr(sxAddr.scan_pubkey).c_str()); //pubkey[0] + LogPrintf("sxAddr.spend_pubkey= %s\n", sxAddr.spend_pubkey[0]); //pkSpend[0] + LogPrintf("secretShared.e[0]=%s \n",secretShared.e[0]); //sharedSOut + LogPrintf("pkSendTo= %"PRIszu": %s\n", pkSendTo.size(), HexStr(pkSendTo).c_str());//pkOut +
Code added
+ LogPrintf("CPubKey(pkSendTo)=%s \n",cpkTo.GetHash().ToString().c_str());
Code added
- CKeyID ckidTo = cpkTo.GetID(); + CKeyID ckidTo = cpkTo.GetID();
Code replaced, not sure why?
+ LogPrintf("Stealth send to generated pubkey,pkSendTo= %"PRIszu": %s\n", pkSendTo.size(), HexStr(pkSendTo).c_str()); + LogPrintf("hash, Address= %s\n", addrTo.ToString().c_str()); + LogPrintf("enerate ephem public key,ephem_pubkey= %"PRIszu": %s\n", ephem_pubkey.size(), HexStr(ephem_pubkey).c_str());
Replace LogPrintf code
- //scriptPubKey.SetDestination(CBitcoinAddress(rcp.address.toStdString()).Get());
Remove code
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Add debug dialog : - commit
https://github.com/FeatherCoin/Feathercoin/commit/53644b506ce7b817a4135633184bd3d678b390d5
debug dialog
src/qt/walletview.cpp
+ } + + void WalletView::debugClicked() + { + if(!walletModel) + return; + + DebugDialog dlg(this); + dlg.setModel(walletModel); + dlg.exec();
Code added
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Add debug dialog : - commit
https://github.com/FeatherCoin/Feathercoin/commit/53644b506ce7b817a4135633184bd3d678b390d5
debug dialog
src/qt/walletview.h
+ /** Open Debug dialog **/ + void debugClicked();
Code added
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Add debug dialog : - commit
https://github.com/FeatherCoin/Feathercoin/commit/53644b506ce7b817a4135633184bd3d678b390d5
debug dialog
src/rpcclient.cpp
+ if (strMethod == "sendtostealthaddress" && n > 1) ConvertTo<double>(params[1]); + if (strMethod == "scanforstealthtxns" && n > 0) ConvertTo<int>(params[0]); + if (strMethod == "scanforalltxns" && n > 0) ConvertTo<int>(params[0]);
Code added
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Add debug dialog : - commit
https://github.com/FeatherCoin/Feathercoin/commit/53644b506ce7b817a4135633184bd3d678b390d5
debug dialog
src/rpcwallet.cpp
- result.push_back(Pair("result", "Invalid Deepcoin stealth address.")); + result.push_back(Pair("result", "Invalid Feathercoin stealth address."));
Deepcoin code replaced Feathercoin ?? Translations?
+ pindex = mapBlockIndex[chainActive.Tip()->GetBlockHash()];//[hashBestChain];
Code replaced
+ printf("Scan open from %d ................\n",nFromHeight);
Code added
+ ReadBlockFromDisk(block, pindex); //block.ReadFromDisk(pindex); + printf("pindex->nHeight=%d \n",pindex->nHeight);
Code added
+ typedef boost::tuple<uint256, std::vector<unsigned char>, std::vector<unsigned char> > sigdata_type; + Get(uint256 hash, const std::vector<unsigned char>& vchSig, const std::vector<unsigned char>& pubKey) + void Set(uint256 hash, const std::vector<unsigned char>& vchSig, const std::vector<unsigned char>& pubKey) +bool CheckSig(vector<unsigned char> vchSig, vector<unsigned char> vchPubKey, CScript scriptCode, + /* CPubKey pubkey(vchPubKey); + return false; */ + if (signatureCache.Get(sighash, vchSig, vchPubKey)) + if (!CPubKey(vchPubKey).Verify(sighash, vchSig)) + signatureCache.Set(sighash, vchSig, vchPubKey);
Code replaced
Code replaced
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Add debug dialog : - commit
https://github.com/FeatherCoin/Feathercoin/commit/53644b506ce7b817a4135633184bd3d678b390d5
debug dialog, various rv parameter definitions are changed
src/stealth.cpp
- Q = dG + Q = dG //µ¥´ÎʹÓõÄ˽Կ
Code replaced
- rv = 1; + rv = 2;
Code replaced
- rv = 1; + rv = 3;
Code replaced
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Add debug dialog : - commit
https://github.com/FeatherCoin/Feathercoin/commit/53644b506ce7b817a4135633184bd3d678b390d5
debug dialog
src/wallet.cpp
+ LogPrintf("AddToWalletIfInvolvingMe,hash=%s .\n",hash.ToString());
Code added
- if (fDebug) - printf("FindStealthTransactions() tx: %s\n", tx.GetHash().GetHex().c_str()); + LogPrintf("FindStealthTransactions() tx:%s,", tx.GetHash().GetHex().c_str()); + if (tx.GetHash().GetHex().compare("85568ae1dacfdc6730b0d2ddeb2c4d7d07b0ac702e6d9a7f408293e2cd628d57")==1) + { + LogPrintf("no debug.\n"); + return false; + }
Code replaced
- ec_secret sShared; - ec_point pkExtracted; + ec_secret sShared; + ec_point pkExtracted;
Code replaced
+ LogPrintf("BOOST_FOREACH nOutputIdOuter=%d ,find txout...\n", nOutputIdOuter); + LogPrintf("txout scriptPubKey= %s\n", txout.scriptPubKey.ToString().c_str()); //OP_RETURN 02fe58a19a83c9ce0fc129bfa0a6a53b3440b6f9eac357143b23be38b7779c53d2 + LogPrintf("txout hash = %s\n", txout.GetHash().GetHex().c_str()); //5bada4eca0588e4dbb33ec37bd658dfdd7b9bce1e3ad3aa68461151f2e835597
Code replaced
+ LogPrintf("in txout.scriptPubKey,check vchEphemPK=%s\n", HexStr(vchEphemPK).c_str()); //
Code added
- BOOST_FOREACH(const CTxOut& txoutB, tx.vout) + BOOST_FOREACH(const CTxOut& txoutB, tx.vout) //tx.vout again
tx.vout removed
+ LogPrintf("BOOST_FOREACH nOutputId=%d ,print param.....\n", nOutputId);
Code added
- if (&txoutB == &txout) + if (&txoutB == &txout) //把OP_RETURN交易分别与另2个执行
Comment add in chinese
+ LogPrintf("CTxOut: %s\n", txoutB.ToString().c_str()); + LogPrintf("only 1 txn will match an ephem pk,tx.vout scriptPubKey %s\n", txoutB.scriptPubKey.ToString().c_str()); + //OP_DUP OP_HASH160 d0ae59f757fc9ce14559413e2d00ac8fede6f9a2 OP_EQUALVERIFY OP_CHECKSIG
Code added
+ CKeyID ckidMatch = boost::get<CKeyID>(address);
Code replaced
+ LogPrintf("CTxDestination=CKeyID,ckidMatch=%s \n", ckidMatch.ToString().c_str()); + //a2f9e6ed8fac002d3e415945e19cfc57f759aed0 + int i=0; + i++; + LogPrintf("StealthAddress iterator=%d \n", i); // + LogPrintf("it->scan_secret.size() %d\n", it->scan_secret.size()); + LogPrintf("it->Encodeded() %s\n", it->Encoded().c_str()); //找到收款人隐身公匙地址 + memcpy(&sScan.e[0], &it->scan_secret[0], ec_secret_size);
Code added
+ LogPrintf("StealthAddress Label=%s \n",it->label); + LogPrintf("StealthAddress Address=%s \n",it->Encoded()); + LogPrintf("StealthAddress Scan Secret=%s \n",HexStr(it->scan_secret.begin(), it->scan_secret.end()));//f1e76e169c05b00ad755ef6128a1fe2ccc1f2351383f5a5969f4040994d3f25e + LogPrintf("StealthAddress Scan Pubkey=%s \n",HexStr(it->scan_pubkey.begin(), it->scan_pubkey.end()));//038cf92caa6f1fe56b19e09cca0bdc52a81e46007bc12622688c0feda804f9d073 + LogPrintf("StealthAddress Spend Secret=%s \n",HexStr(it->spend_secret.begin(), it->spend_secret.end()));//117a9e4a428e7549eeeaa1dc3deb5cab2696518e2af0849fc6b7d675fe0a10ee + LogPrintf("StealthAddress Spend Pubkey=%s \n",HexStr(it->spend_pubkey.begin(), it->spend_pubkey.end())); + //02ffae1e8fda48c5ff6824ac0d497ea3c3b1ef3a438832bd5e5edc0bf4f93172d6,与OP_RETURN不匹配 + LogPrintf("sScan.e=%s\n",sScan.e); //收款人隐身公匙地址,secret + LogPrintf("vchEphemPK=%s\n", HexStr(vchEphemPK).c_str()); //pubkey[0],可能是个问题 + LogPrintf("it->spend_pubkey=%s\n", HexStr(it->spend_pubkey)); //pkSpend[0] 02ffae1e8fda48c5ff6824ac0d497ea3c3b1ef3a438832bd5e5edc0bf4f93172d6 + LogPrintf("sShared.e=%s\n",sShared.e); //sharedSOut + LogPrintf("pkExtracted=%"PRIszu":%s\n", pkExtracted.size(), HexStr(pkExtracted).c_str());//pkOut + + int rv=StealthSecret(sScan, vchEphemPK, it->spend_pubkey, sShared, pkExtracted); + if (rv!= 0) { { + LogPrintf("StealthSecret failed.rv=%d \n",rv); continue; continue; }; }; + LogPrintf("StealthSecret ok.rv=%d \n",rv); + LogPrintf("pkExtracted= %"PRIszu": %s\n", pkExtracted.size(), HexStr(pkExtracted).c_str());//pkOut
Code replaced
+ CPubKey cpkE(pkExtracted); + CKeyID ckidE = cpkE.GetID(); if (ckidMatch != ckidE) if (fDebug) + //if (fDebug) + LogPrintf("Found stealth txn to address %s\n", it->Encoded().c_str());
Code replaced
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Fix sx and CKey/CPubKey : - commit
https://github.com/FeatherCoin/Feathercoin/commit/55252135009938926532ddeabb3ac52d991b4381
src/alert.cpp
- CPubKey key(Params().AlertKey()); + //CPubKey key(Params().AlertKey()); + CKey key; + if (!key.SetPubKey(Params().AlertKey())) + return error("CAlert::CheckSignature() : SetPubKey failed"); +
Code replaced
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Fix sx and CKey/CPubKey : - commit
https://github.com/FeatherCoin/Feathercoin/commit/55252135009938926532ddeabb3ac52d991b4381
src/base58.cpp
+/* void CBitcoinSecret::SetKey(const CKey& vchSecret) { assert(vchSecret.IsValid()); SetData(Params().Base58Prefix(CChainParams::SECRET_KEY), vchSecret.begin(), vchSecret.size()); if (vchSecret.IsCompressed()) vchData.push_back(1); -} +}*/
Code commented out
+ void CBitcoinSecret::SetSecret(const CSecret& vchSecret, bool fCompressed) + { + assert(vchSecret.size() == 32); + SetData(Params().Base58Prefix(CChainParams::SECRET_KEY), &vchSecret[0], vchSecret.size()); + if (fCompressed) + vchData.push_back(1); + } + /*
Code added
+ }*/ + + CSecret CBitcoinSecret::GetSecret(bool &fCompressedOut) + { + CSecret vchSecret; + vchSecret.resize(32); + memcpy(&vchSecret[0], &vchData[0], 32); + fCompressedOut = vchData.size() == 33; + return vchSecret;
Code added
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Fix sx and CKey/CPubKey : - commit
https://github.com/FeatherCoin/Feathercoin/commit/55252135009938926532ddeabb3ac52d991b4381
src/base58.h
+ //void SetKey(const CKey& vchSecret); + void SetSecret(const CSecret& vchSecret, bool fCompressed); + //CKey GetKey(); + CSecret GetSecret(bool &fCompressedOut);
Code replaced
+ //CBitcoinSecret(const CKey& vchSecret) { SetKey(vchSecret); } + CBitcoinSecret(const CSecret& vchSecret, bool fCompressed) + { + SetSecret(vchSecret, fCompressed); + }
Code replaced
+ //typedef CBitcoinExtKeyBase<CExtKey, 74, CChainParams::EXT_SECRET_KEY> CBitcoinExtKey; -typedef CBitcoinExtKeyBase<CExtPubKey, 74, CChainParams::EXT_PUBLIC_KEY> CBitcoinExtPubKey; + //typedef CBitcoinExtKeyBase<CExtPubKey, 74, CChainParams::EXT_PUBLIC_KEY> CBitcoinExtPubKey;
Code replaced
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Fix sx and CKey/CPubKey : - commit
https://github.com/FeatherCoin/Feathercoin/commit/55252135009938926532ddeabb3ac52d991b4381
src/checkpointsync.cpp
+ //CKey key = vchSecret.GetKey(); // if key is not correct openssl may crash + CKey key; + bool fCompressed; + CSecret secret = vchSecret.GetSecret(fCompressed); + key.SetSecret(secret, fCompressed); // if key is not correct openssl may crash
Code replaced
+ //CKey key = vchSecret.GetKey(); // if key is not correct openssl may crash + CKey key; + bool fCompressed; + CSecret secret = vchSecret.GetSecret(fCompressed); + key.SetSecret(secret, fCompressed); // if key is not correct openssl may crash
Code added
+ CKey key;
Code added
+ //CPubKey key(ParseHex(strMasterPubKey)); + if (!key.SetPubKey(ParseHex(strMasterPubKey))) + return error("CSyncCheckpoint::CheckSignature() : SetPubKey failed");
Code added
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Fix sx and CKey/CPubKey : - commit
https://github.com/FeatherCoin/Feathercoin/commit/55252135009938926532ddeabb3ac52d991b4381
src/crypter.cpp
+//bool EncryptSecret(const CKeyingMaterial& vMasterKey, const CKeyingMaterial &vchPlaintext, const uint256& nIV, std::vector<unsigned char> &vchCiphertext) +bool EncryptSecret(CKeyingMaterial& vMasterKey, const CSecret &vchPlaintext, const uint256& nIV, std::vector<unsigned char> &vchCiphertext)
Code replaced
+ //return cKeyCrypter.Encrypt(*((const CKeyingMaterial*)&vchPlaintext), vchCiphertext); + return cKeyCrypter.Encrypt((CKeyingMaterial)vchPlaintext, vchCiphertext);
Code replaced
+//bool DecryptSecret(const CKeyingMaterial& vMasterKey, const std::vector<unsigned char>& vchCiphertext, const uint256& nIV, CKeyingMaterial& vchPlaintext) +bool DecryptSecret(const CKeyingMaterial& vMasterKey, const std::vector<unsigned char>& vchCiphertext, const uint256& nIV, CSecret& vchPlaintext)
Code replaced
+ { + LOCK(cs_KeyStore); + if (fUseCrypto) + return true; + if (!mapKeys.empty()) + return false; + fUseCrypto = true; + }
Code replace
+ //CKeyingMaterial vchSecret; + CSecret vchSecret;
Code replaced
+ //key.Set(vchSecret.begin(), vchSecret.end(), vchPubKey.IsCompressed()); + key.SetPubKey(vchPubKey); + key.SetSecret(vchSecret);
Code replaced
+//bool CCryptoKeyStore::AddKeyPubKey(const CKey& key, const CPubKey &pubkey) +bool CCryptoKeyStore::AddKey(const CKey& key)
Code replaced
+ //return CBasicKeyStore::AddKeyPubKey(key, pubkey); + return CBasicKeyStore::AddKey(key);
Code replaced
+ //CKeyingMaterial vchSecret(key.begin(), key.end()); + CPubKey vchPubKey = key.GetPubKey(); + bool fCompressed; + //if (!EncryptSecret(vMasterKey, vchSecret, pubkey.GetHash(), vchCryptedSecret)) + if (!EncryptSecret(vMasterKey, key.GetSecret(fCompressed), vchPubKey.GetHash(), vchCryptedSecret))
Code replaced
+ //if (!AddCryptedKey(pubkey, vchCryptedSecret)) + if (!AddCryptedKey(key.GetPubKey(), vchCryptedSecret))
Code replaced
+ //CKeyingMaterial vchSecret; + CSecret vchSecret;
Copde replaced
+ //keyOut.Set(vchSecret.begin(), vchSecret.end(), vchPubKey.IsCompressed()); + keyOut.SetPubKey(vchPubKey); + keyOut.SetSecret(vchSecret);
Code replaced
+ //const CKey &key = mKey.second; + //CPubKey vchPubKey = key.GetPubKey(); + //CKeyingMaterial vchSecret(key.begin(), key.end()); + CKey key; + if (!key.SetSecret(mKey.second.first, mKey.second.second)) + return false; + const CPubKey vchPubKey = key.GetPubKey();
Code replaced
+ //if (!EncryptSecret(vMasterKeyIn, vchSecret, vchPubKey.GetHash(), vchCryptedSecret)) + bool fCompressed; + if (!EncryptSecret(vMasterKeyIn, key.GetSecret(fCompressed), vchPubKey.GetHash(), vchCryptedSecret))
Code replaced
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Fix sx and CKey/CPubKey : - commit
https://github.com/FeatherCoin/Feathercoin/commit/55252135009938926532ddeabb3ac52d991b4381
src/crypter.h
+//bool EncryptSecret(const CKeyingMaterial& vMasterKey, const CKeyingMaterial &vchPlaintext, const uint256& nIV, std::vector<unsigned char> &vchCiphertext); +//bool DecryptSecret(const CKeyingMaterial& vMasterKey, const std::vector<unsigned char>& vchCiphertext, const uint256& nIV, CKeyingMaterial& vchPlaintext); +bool EncryptSecret(CKeyingMaterial& vMasterKey, const CSecret &vchPlaintext, const uint256& nIV, std::vector<unsigned char> &vchCiphertext); +bool DecryptSecret(const CKeyingMaterial& vMasterKey, const std::vector<unsigned char> &vchCiphertext, const uint256& nIV, CSecret &vchPlaintext);
Code replaced
+ //bool AddKeyPubKey(const CKey& key, const CPubKey &pubkey); + bool AddKey(const CKey& key);
Code added
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Fix sx and CKey/CPubKey : - commit
https://github.com/FeatherCoin/Feathercoin/commit/55252135009938926532ddeabb3ac52d991b4381
src/key.cpp
Large amount of code added and removed. Examples of code replaced.
+#include <map>
Code replaced
-#include <openssl/bn.h> -#include <openssl/rand.h>
Code removed
+void CKey::SetCompressedPubKey(bool fCompressed) + EC_KEY_set_conv_form(pkey, fCompressed ? POINT_CONVERSION_COMPRESSED : POINT_CONVERSION_UNCOMPRESSED); + fCompressedPubKey = true;
Complete functions replaced
+void CKey::Reset() +CKey::CKey(const CKey& b) +bool CKey::SetPrivKey(const CPrivKey& vchPrivKey) + const unsigned char* pbegin = &vchPrivKey[0]; +bool CKey::SetSecret(const CSecret& vchSecret, bool fCompressed +CSecret CKey::GetSecret(bool &fCompressed) const +CPrivKey CKey::GetPrivKey() const +CPubKey CKey::GetPubKey() const
Various functions replaced
+// create a compact signature (65 bytes), which allows reconstructing the used public key +// The format is one header byte, followed by two times 32 bytes for the serialized r and s values. +// The header byte: 0x1B = first key with even y, 0x1C = first key with odd y, +// 0x1D = second key with even y, 0x1E = second key with o +bool CKey::SignCompact(uint256 hash, std::vector<unsigned char>& vchSig)
Code replaced
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Fix sx and CKey/CPubKey : - commit
https://github.com/FeatherCoin/Feathercoin/commit/55252135009938926532ddeabb3ac52d991b4381
src/key.h
+#include <stdexcept> +#include <vector> +#include "hash.h" +#include <openssl/ec.h> // for EC_KEY definition
Code added
+ // secp160k1 + // const unsigned int PRIVATE_KEY_SIZE = 192; + // const unsigned int PUBLIC_KEY_SIZE = 41; + // const unsigned int SIGNATURE_SIZE = 48; + // + // secp192k1 + // const unsigned int PRIVATE_KEY_SIZE = 222; + // const unsigned int PUBLIC_KEY_SIZE = 49; + // const unsigned int SIGNATURE_SIZE = 57; + // + // secp224k1 + // const unsigned int PRIVATE_KEY_SIZE = 250; + // const unsigned int PUBLIC_KEY_SIZE = 57; + // const unsigned int SIGNATURE_SIZE = 66; + //
Code added
+ class key_error : public std::runtime_error + { + public: + explicit key_error(const std::string& str) : std::runtime_error(str) {} + }; +
Code added
+ unsigned char *begin() { + return vch; Code replaced + friend class CKey; + public: + CPubKey() { vch[0] = 0xFF; }
Code added
+ CPubKey(const std::vector<unsigned char> &vchPubKeyIn) { + int len = vchPubKeyIn.empty() ? 0 : GetLen(vchPubKeyIn[0]); + if (len) { + memcpy(vch, &vchPubKeyIn[0], len); + } else { + vch[0] = 0xFF; + }
Code replaced
+ unsigned int size() const { + return GetLen(vch[0]);
Code replaced
+ const unsigned char *begin() const { + return vch;
Code replaced
+ const unsigned char *end() const { + return vch+size();
Code replaced
+ + friend bool operator==(const CPubKey &a, const CPubKey &b) { return memcmp(a.vch, b.vch, a.size()) == 0; } + friend bool operator!=(const CPubKey &a, const CPubKey &b) { return memcmp(a.vch, b.vch, a.size()) != 0; }
Code added
+ (a.vch[0] == b.vch[0] && memcmp(a.vch+1, b.vch+1, a.size() - 1) < 0);
Code replaced
+ // invalid pubkey + vch[0] = 0xFF;
Code added
+ //bool IsFullyValid() const;
Code commented out
+ return std::vector<unsigned char>(vch, vch+size());
Code replaced
+/** An encapsulated OpenSSL Elliptic Curve key (public and/or private) */ +class CKey +{ +protected: + EC_KEY* pkey; + bool fSet; + bool fCompressedPubKey;
Code replaced
+ void SetCompressedPubKey(bool fCompressed = true); + void Reset();
Code replaced
+ CKey(); + CKey(const CKey& b); + CKey& operator=(const CKey& b); + ~CKey(); + bool IsNull() const; + bool IsCompressed() const; + bool SetPrivKey(const CPrivKey& vchPrivKey); + bool SetSecret(const CSecret& vchSecret, bool fCompressed = false); + CSecret GetSecret(bool &fCompressed) const; + bool SetPubKey(const CPubKey& vchPubKey); + bool Sign(uint256 hash, std::vector<unsigned char>& vchSig); + // create a compact signature (65 bytes), which allows reconstructing the used public key // The format is one header byte, followed by two times 32 bytes for the serialized r and s values. // The header byte: 0x1B = first key with even y, 0x1C = first key with odd y, + // 0x1D = second key with even y, 0x1E = second key with odd y + bool SignCompact(uint256 hash, std::vector<unsigned char>& vchSig);
Code replaced
+ // reconstruct public key from a compact signature + // This is only slightly more CPU intensive than just verifying it. + // If this function succeeds, the recovered public key is guaranteed to be valid + // (the signature is a valid signature of the given data for that key) + bool SetCompactSignature(uint256 hash, const std::vector<unsigned char>& vchSig);
Code replaced
+ bool Verify(uint256 hash, const std::vector<unsigned char>& vchSig);
Code replaced
+ // Verify a compact signature + bool VerifyCompact(uint256 hash, const std::vector<unsigned char>& vchSig);
Code replaced
+ bool IsValid(); + + // Check whether an element of a signature (r or s) is valid. + static bool CheckSignatureElement(const unsigned char *vch, int len, bool half);
Code replaced
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Fix sx and CKey/CPubKey : - commit
https://github.com/FeatherCoin/Feathercoin/commit/55252135009938926532ddeabb3ac52d991b4381
src/keystore.cpp
+bool CBasicKeyStore::AddKey(const CKey& key)
Code replaced
+ bool fCompressed = false; + CSecret secret = key.GetSecret(fCompressed); + { + LOCK(cs_KeyStore); + mapKeys[key.GetPubKey().GetID()] = make_pair(secret, fCompressed); + }
Code replaced
+ { + LOCK(cs_KeyStore); + mapScripts[redeemScript.GetID()] = redeemScript; + }
Code replaced
+ bool result; + { + LOCK(cs_KeyStore); + result = (mapScripts.count(hash) > 0); + } + return result;
Code replaced
+ LOCK(cs_KeyStore); + ScriptMap::const_iterator mi = mapScripts.find(hash); + if (mi != mapScripts.end()) + { + redeemScriptOut = (*mi).second; + return true;
Code replaced
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Fix sx and CKey/CPubKey : - commit
https://github.com/FeatherCoin/Feathercoin/commit/55252135009938926532ddeabb3ac52d991b4381
src/keystore.h
+ //virtual bool AddKeyPubKey(const CKey &key, const CPubKey &pubkey) =0; + //virtual bool AddKey(const CKey &key); + virtual bool AddKey(const CKey& key) =0;
Code replaced
+ + virtual bool GetSecret(const CKeyID &address, CSecret& vchSecret, bool &fCompressed) const + { + CKey key; + if (!GetKey(address, key)) + return false; + vchSecret = key.GetSecret(fCompressed); + return true; + }
Code replaced
+//typedef std::map<CKeyID, CKey> KeyMap; +typedef std::map<CKeyID, std::pair<CSecret, bool> > KeyMap;
Code replaced
+ //bool AddKeyPubKey(const CKey& key, const CPubKey &pubkey); + bool AddKey(const CKey& key);
Code replaced
+ keyOut.Reset(); + keyOut.SetSecret((*mi).second.first, (*mi).second.second);
Code replaced
-
Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*
Fix sx and CKey/CPubKey : - commit
https://github.com/FeatherCoin/Feathercoin/commit/55252135009938926532ddeabb3ac52d991b4381
src/qt/bitcoingui.cpp
+ debugAction = new QAction(QIcon(":/icons/sx"), tr("&SX Tool"), this); + debugAction->setStatusTip(tr("SX Tool"));
Code replaced