MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / CheckTimeLock

Function CheckTimeLock

src/test/psbt_tests.cpp:22–38  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20}
21
22void CheckTimeLock(const std::string& base64_psbt, std::optional<uint32_t> timelock)
23{
24 util::Result<PartiallySignedTransaction> psbt = DecodeBase64PSBT(base64_psbt);
25 BOOST_CHECK(psbt);
26
27 std::optional<uint32_t> computed_timelock = psbt->ComputeTimeLock();
28 std::optional<CMutableTransaction> tx = psbt->GetUnsignedTx();
29 if (timelock) {
30 BOOST_CHECK(computed_timelock);
31 BOOST_CHECK_EQUAL(*computed_timelock, *timelock);
32 BOOST_CHECK(tx);
33 BOOST_CHECK_EQUAL(tx->nLockTime, *timelock);
34 } else {
35 BOOST_CHECK(!computed_timelock);
36 BOOST_CHECK(!tx);
37 }
38}
39
40BOOST_AUTO_TEST_CASE(psbt2_timelock_test)
41{

Callers 1

BOOST_AUTO_TEST_CASEFunction · 0.85

Calls 3

DecodeBase64PSBTFunction · 0.85
ComputeTimeLockMethod · 0.80
GetUnsignedTxMethod · 0.80

Tested by

no test coverage detected