script/sign: signing support for Miniscript with timelocks

This commit is contained in:
Antoine Poinsot
2021-12-02 17:20:20 +01:00
parent 61c6d1a844
commit a2f81b6a8f
2 changed files with 39 additions and 14 deletions

View File

@@ -438,9 +438,9 @@ struct Satisfier {
}
//! Time lock satisfactions.
// TODO
bool CheckAfter(uint32_t value) const { return false; }
bool CheckOlder(uint32_t value) const { return false; }
bool CheckAfter(uint32_t value) const { return m_creator.Checker().CheckLockTime(CScriptNum(value)); }
bool CheckOlder(uint32_t value) const { return m_creator.Checker().CheckSequence(CScriptNum(value)); }
//! Hash preimage satisfactions.
// TODO
@@ -675,6 +675,8 @@ public:
DummySignatureChecker() = default;
bool CheckECDSASignature(const std::vector<unsigned char>& sig, const std::vector<unsigned char>& vchPubKey, const CScript& scriptCode, SigVersion sigversion) const override { return sig.size() != 0; }
bool CheckSchnorrSignature(Span<const unsigned char> sig, Span<const unsigned char> pubkey, SigVersion sigversion, ScriptExecutionData& execdata, ScriptError* serror) const override { return sig.size() != 0; }
bool CheckLockTime(const CScriptNum& nLockTime) const override { return true; }
bool CheckSequence(const CScriptNum& nSequence) const override { return true; }
};
}