mirror of
https://github.com/dashpay/dash.git
synced 2024-12-27 04:52:59 +01:00
Merge #13266: refactor: privatize SignatureExtractorChecker [moveonly]
73aaf4ecf825a4d18c802ca5dd3856ce9096915e Make SignatureExtractorChecker private to its own file (Ben Woosley) Pull request description: ~If we add a CTxIn constructor to SignatureData, then constructing the SignatureData directly is no more verbose than calling DataFromTransaction, and grants the caller additional flexibiliy in how to provide the CTxIn.~ A simple change to enhance encapsulation. ACKs for top commit: MarcoFalke: utACK 73aaf4ecf825a4d18c802ca5dd3856ce9096915e laanwj: ACK 73aaf4ecf825a4d18c802ca5dd3856ce9096915e Tree-SHA512: f7eafbce22b0e9917a8487e88d1f5a1061f2a0959ae1a097cbd9c8ea0d774edfb807da56813cb5fb26f6ca98499a0604a8ff024c198a7c8dc755164de66d972a
This commit is contained in:
parent
44c7bb618e
commit
8a3389e88e
@ -198,6 +198,7 @@ bool ProduceSignature(const SigningProvider& provider, const BaseSignatureCreato
|
|||||||
return sigdata.complete;
|
return sigdata.complete;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace {
|
||||||
class SignatureExtractorChecker final : public BaseSignatureChecker
|
class SignatureExtractorChecker final : public BaseSignatureChecker
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
@ -206,21 +207,17 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
SignatureExtractorChecker(SignatureData& sigdata, BaseSignatureChecker& checker) : sigdata(sigdata), checker(checker) {}
|
SignatureExtractorChecker(SignatureData& sigdata, BaseSignatureChecker& checker) : sigdata(sigdata), checker(checker) {}
|
||||||
bool CheckSig(const std::vector<unsigned char>& scriptSig, const std::vector<unsigned char>& vchPubKey, const CScript& scriptCode, SigVersion sigversion) const override;
|
bool CheckSig(const std::vector<unsigned char>& scriptSig, const std::vector<unsigned char>& vchPubKey, const CScript& scriptCode, SigVersion sigversion) const override
|
||||||
|
{
|
||||||
|
if (checker.CheckSig(scriptSig, vchPubKey, scriptCode, sigversion)) {
|
||||||
|
CPubKey pubkey(vchPubKey);
|
||||||
|
sigdata.signatures.emplace(pubkey.GetID(), SigPair(pubkey, scriptSig));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
bool SignatureExtractorChecker::CheckSig(const std::vector<unsigned char>& scriptSig, const std::vector<unsigned char>& vchPubKey, const CScript& scriptCode, SigVersion sigversion) const
|
|
||||||
{
|
|
||||||
if (checker.CheckSig(scriptSig, vchPubKey, scriptCode, sigversion)) {
|
|
||||||
CPubKey pubkey(vchPubKey);
|
|
||||||
sigdata.signatures.emplace(pubkey.GetID(), SigPair(pubkey, scriptSig));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace
|
|
||||||
{
|
|
||||||
struct Stacks
|
struct Stacks
|
||||||
{
|
{
|
||||||
std::vector<valtype> script;
|
std::vector<valtype> script;
|
||||||
|
Loading…
Reference in New Issue
Block a user