Changeset View
Changeset View
Standalone View
Standalone View
src/script/interpreter.h
Show All 23 Lines | |||||
uint256 SignatureHash(const CScript &scriptCode, const CTransaction &txTo, | uint256 SignatureHash(const CScript &scriptCode, const CTransaction &txTo, | ||||
unsigned int nIn, SigHashType sigHashType, | unsigned int nIn, SigHashType sigHashType, | ||||
const Amount amount, | const Amount amount, | ||||
const PrecomputedTransactionData *cache = nullptr, | const PrecomputedTransactionData *cache = nullptr, | ||||
uint32_t flags = SCRIPT_ENABLE_SIGHASH_FORKID); | uint32_t flags = SCRIPT_ENABLE_SIGHASH_FORKID); | ||||
class BaseSignatureChecker { | class BaseSignatureChecker { | ||||
public: | public: | ||||
virtual bool VerifySignature(const std::vector<uint8_t> &vchSig, | virtual bool VerifySignature(bool isSchnorr, | ||||
deadalnix: D not add bool parameters to functions if it can be avoided. It makes for terrible API. See… | |||||
markblundebergAuthorUnsubmitted Done Inline ActionsYes, it's possible to do it with duplicated API instead. markblundeberg: Yes, it's possible to do it with duplicated API instead. | |||||
const std::vector<uint8_t> &vchSig, | |||||
const CPubKey &vchPubKey, | const CPubKey &vchPubKey, | ||||
const uint256 &sighash) const; | const uint256 &sighash) const; | ||||
virtual bool CheckSig(const std::vector<uint8_t> &scriptSig, | virtual bool CheckSig(bool isSchnorr, const std::vector<uint8_t> &scriptSig, | ||||
const std::vector<uint8_t> &vchPubKey, | const std::vector<uint8_t> &vchPubKey, | ||||
const CScript &scriptCode, uint32_t flags) const { | const CScript &scriptCode, uint32_t flags) const { | ||||
return false; | return false; | ||||
} | } | ||||
virtual bool CheckLockTime(const CScriptNum &nLockTime) const { | virtual bool CheckLockTime(const CScriptNum &nLockTime) const { | ||||
return false; | return false; | ||||
} | } | ||||
Show All 17 Lines | TransactionSignatureChecker(const CTransaction *txToIn, unsigned int nInIn, | ||||
const Amount amountIn) | const Amount amountIn) | ||||
: txTo(txToIn), nIn(nInIn), amount(amountIn), txdata(nullptr) {} | : txTo(txToIn), nIn(nInIn), amount(amountIn), txdata(nullptr) {} | ||||
TransactionSignatureChecker(const CTransaction *txToIn, unsigned int nInIn, | TransactionSignatureChecker(const CTransaction *txToIn, unsigned int nInIn, | ||||
const Amount amountIn, | const Amount amountIn, | ||||
const PrecomputedTransactionData &txdataIn) | const PrecomputedTransactionData &txdataIn) | ||||
: txTo(txToIn), nIn(nInIn), amount(amountIn), txdata(&txdataIn) {} | : txTo(txToIn), nIn(nInIn), amount(amountIn), txdata(&txdataIn) {} | ||||
// The overriden functions are now final. | // The overriden functions are now final. | ||||
bool CheckSig(const std::vector<uint8_t> &scriptSig, | bool CheckSig(bool isSchnorr, const std::vector<uint8_t> &scriptSig, | ||||
const std::vector<uint8_t> &vchPubKey, | const std::vector<uint8_t> &vchPubKey, | ||||
const CScript &scriptCode, | const CScript &scriptCode, | ||||
uint32_t flags) const final override; | uint32_t flags) const final override; | ||||
bool CheckLockTime(const CScriptNum &nLockTime) const final override; | bool CheckLockTime(const CScriptNum &nLockTime) const final override; | ||||
bool CheckSequence(const CScriptNum &nSequence) const final override; | bool CheckSequence(const CScriptNum &nSequence) const final override; | ||||
}; | }; | ||||
class MutableTransactionSignatureChecker : public TransactionSignatureChecker { | class MutableTransactionSignatureChecker : public TransactionSignatureChecker { | ||||
Show All 18 Lines |
D not add bool parameters to functions if it can be avoided. It makes for terrible API. See https://softwareengineering.stackexchange.com/questions/147977/is-it-wrong-to-use-a-boolean-parameter-to-determine-behavior for instance.