Skip to content

Commit 752debd

Browse files
committed
Merge #13266: refactor: privatize SignatureExtractorChecker [moveonly]
73aaf4e 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 73aaf4e laanwj: ACK 73aaf4e Tree-SHA512: f7eafbce22b0e9917a8487e88d1f5a1061f2a0959ae1a097cbd9c8ea0d774edfb807da56813cb5fb26f6ca98499a0604a8ff024c198a7c8dc755164de66d972a
2 parents 1f40a91 + 73aaf4e commit 752debd

File tree

1 file changed

+10
-13
lines changed

1 file changed

+10
-13
lines changed

src/script/sign.cpp

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,7 @@ bool ProduceSignature(const SigningProvider& provider, const BaseSignatureCreato
244244
return sigdata.complete;
245245
}
246246

247+
namespace {
247248
class SignatureExtractorChecker final : public BaseSignatureChecker
248249
{
249250
private:
@@ -252,21 +253,17 @@ class SignatureExtractorChecker final : public BaseSignatureChecker
252253

253254
public:
254255
SignatureExtractorChecker(SignatureData& sigdata, BaseSignatureChecker& checker) : sigdata(sigdata), checker(checker) {}
255-
bool CheckSig(const std::vector<unsigned char>& scriptSig, const std::vector<unsigned char>& vchPubKey, const CScript& scriptCode, SigVersion sigversion) const override;
256-
};
257-
258-
bool SignatureExtractorChecker::CheckSig(const std::vector<unsigned char>& scriptSig, const std::vector<unsigned char>& vchPubKey, const CScript& scriptCode, SigVersion sigversion) const
259-
{
260-
if (checker.CheckSig(scriptSig, vchPubKey, scriptCode, sigversion)) {
261-
CPubKey pubkey(vchPubKey);
262-
sigdata.signatures.emplace(pubkey.GetID(), SigPair(pubkey, scriptSig));
263-
return true;
256+
bool CheckSig(const std::vector<unsigned char>& scriptSig, const std::vector<unsigned char>& vchPubKey, const CScript& scriptCode, SigVersion sigversion) const override
257+
{
258+
if (checker.CheckSig(scriptSig, vchPubKey, scriptCode, sigversion)) {
259+
CPubKey pubkey(vchPubKey);
260+
sigdata.signatures.emplace(pubkey.GetID(), SigPair(pubkey, scriptSig));
261+
return true;
262+
}
263+
return false;
264264
}
265-
return false;
266-
}
265+
};
267266

268-
namespace
269-
{
270267
struct Stacks
271268
{
272269
std::vector<valtype> script;

0 commit comments

Comments
 (0)