mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-04-14 01:27:24 +02:00
Merge bitcoin/bitcoin#30577: miniscript: Use ToIntegral instead of ParseInt64
6714276d72miniscript: Use `ToIntegral` instead of `ParseInt64` (brunoerg) Pull request description: Currently, miniscript code uses `ParseInt64` function for `after`, `older`, `multi` and `thresh` fragments. It means that a leading `+` or whitespace, among other things, are accepted into the fragments. However, these cases are not useful and cause Bitcoin Core to behave differently compared to other miniscript implementations (see https://github.com/brunoerg/bitcoinfuzz/issues/34). This PR fixes it. ACKs for top commit: achow101: ACK6714276d72tdb3: cr ACK6714276d72danielabrozzoni: tACK6714276d72darosior: utACK6714276d72Tree-SHA512: d9eeb93f380f346d636513eeaf26865285e7b0907b8ed258fe1e02153a9eb69d484c82180eb1c78b0ed77ad5f0e5b244be6672c2f890b1d9fddc9e844bee6dde
This commit is contained in:
@@ -699,6 +699,12 @@ BOOST_AUTO_TEST_CASE(fixed_tests)
|
||||
const auto insane_sub = ms_ins->FindInsaneSub();
|
||||
BOOST_CHECK(insane_sub && *insane_sub->ToString(wsh_converter) == "and_b(after(1),a:after(1000000000))");
|
||||
|
||||
// Numbers can't be prefixed by a sign.
|
||||
BOOST_CHECK(!miniscript::FromString("after(-1)", wsh_converter));
|
||||
BOOST_CHECK(!miniscript::FromString("after(+1)", wsh_converter));
|
||||
BOOST_CHECK(!miniscript::FromString("thresh(-1,pk(03cdabb7f2dce7bfbd8a0b9570c6fd1e712e5d64045e9d6b517b3d5072251dc204))", wsh_converter));
|
||||
BOOST_CHECK(!miniscript::FromString("multi(+1,03cdabb7f2dce7bfbd8a0b9570c6fd1e712e5d64045e9d6b517b3d5072251dc204)", wsh_converter));
|
||||
|
||||
// Timelock tests
|
||||
Test("after(100)", "?", "?", TESTMODE_VALID | TESTMODE_NONMAL); // only heightlock
|
||||
Test("after(1000000000)", "?", "?", TESTMODE_VALID | TESTMODE_NONMAL); // only timelock
|
||||
|
||||
Reference in New Issue
Block a user