Skip to content

Commit

Permalink
Use mnemonic script for multisig test to improve verifiability.
Browse files Browse the repository at this point in the history
  • Loading branch information
evoskuil committed Oct 23, 2017
1 parent 6a84bdb commit b194115
Showing 1 changed file with 9 additions and 15 deletions.
24 changes: 9 additions & 15 deletions test/chain/script.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,15 @@ BOOST_AUTO_TEST_CASE(script__clear__non_empty__empty)
BOOST_REQUIRE(instance.empty());
}

BOOST_AUTO_TEST_CASE(script__pattern__two_of_three_multisig__match)
{
script instance;
instance.from_string("2 [03dcfd9e580de35d8c2060d76dbf9e5561fe20febd2e64380e860a4d59f15ac864] [02440e0304bf8d32b2012994393c6a477acf238dd6adb4c3cef5bfa72f30c9861c] [03624505c6cc3967352cce480d8550490dd68519cd019066a4c302fdfb7d1c9934] 3 checkmultisig");
BOOST_REQUIRE(instance.is_valid());
BOOST_REQUIRE(script::is_pay_multisig_pattern(instance.operations()));
BOOST_REQUIRE(instance.pattern() == machine::script_pattern::pay_multisig);
}

// Data-driven test.
//------------------------------------------------------------------------------

Expand Down Expand Up @@ -521,19 +530,4 @@ BOOST_AUTO_TEST_CASE(script__native__block_438513_tx__valid)
BOOST_REQUIRE_EQUAL(result.value(), error::success);
}

BOOST_AUTO_TEST_CASE(script__pattern__multisig_verify_pr811__valid)
{
// generated multisig script
static const auto encoded_script = "522103dcfd9e580de35d8c2060d76dbf9e5561fe20febd2e64380e860a4d59f15ac8642102440e0304bf8d32b2012994393c6a477acf238dd6adb4c3cef5bfa72f30c9861c2103624505c6cc3967352cce480d8550490dd68519cd019066a4c302fdfb7d1c993453ae";

data_chunk decoded_script;
BOOST_REQUIRE(decode_base16(decoded_script, encoded_script));

auto scr = script::factory(decoded_script, false);

BOOST_REQUIRE(scr.is_valid());

BOOST_REQUIRE(machine::script_pattern::pay_multisig == scr.pattern());
}

BOOST_AUTO_TEST_SUITE_END()

0 comments on commit b194115

Please sign in to comment.