mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-17 13:07:54 +02:00
Merge 152ddb3197 into merged_master (Bitcoin PR #20180)
This commit is contained in:
commit
5ca702b5d9
1 changed files with 30 additions and 30 deletions
|
|
@ -1351,36 +1351,6 @@ static CScript ScriptFromHex(const std::string& str)
|
|||
return CScript(data.begin(), data.end());
|
||||
}
|
||||
|
||||
static CMutableTransaction TxFromHex(const std::string& str)
|
||||
{
|
||||
CMutableTransaction tx;
|
||||
VectorReader(SER_DISK, SERIALIZE_TRANSACTION_NO_WITNESS, ParseHex(str), 0) >> tx;
|
||||
return tx;
|
||||
}
|
||||
|
||||
static std::vector<CTxOut> TxOutsFromJSON(const UniValue& univalue)
|
||||
{
|
||||
assert(univalue.isArray());
|
||||
std::vector<CTxOut> prevouts;
|
||||
for (size_t i = 0; i < univalue.size(); ++i) {
|
||||
CTxOut txout;
|
||||
VectorReader(SER_DISK, 0, ParseHex(univalue[i].get_str()), 0) >> txout;
|
||||
prevouts.push_back(std::move(txout));
|
||||
}
|
||||
return prevouts;
|
||||
}
|
||||
|
||||
static CScriptWitness ScriptWitnessFromJSON(const UniValue& univalue)
|
||||
{
|
||||
assert(univalue.isArray());
|
||||
CScriptWitness scriptwitness;
|
||||
for (size_t i = 0; i < univalue.size(); ++i) {
|
||||
auto bytes = ParseHex(univalue[i].get_str());
|
||||
scriptwitness.stack.push_back(std::move(bytes));
|
||||
}
|
||||
return scriptwitness;
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(script_FindAndDelete)
|
||||
{
|
||||
// Exercise the FindAndDelete functionality
|
||||
|
|
@ -1506,6 +1476,36 @@ BOOST_AUTO_TEST_CASE(script_HasValidOps)
|
|||
|
||||
#if defined(HAVE_CONSENSUS_LIB)
|
||||
|
||||
static CMutableTransaction TxFromHex(const std::string& str)
|
||||
{
|
||||
CMutableTransaction tx;
|
||||
VectorReader(SER_DISK, SERIALIZE_TRANSACTION_NO_WITNESS, ParseHex(str), 0) >> tx;
|
||||
return tx;
|
||||
}
|
||||
|
||||
static std::vector<CTxOut> TxOutsFromJSON(const UniValue& univalue)
|
||||
{
|
||||
assert(univalue.isArray());
|
||||
std::vector<CTxOut> prevouts;
|
||||
for (size_t i = 0; i < univalue.size(); ++i) {
|
||||
CTxOut txout;
|
||||
VectorReader(SER_DISK, 0, ParseHex(univalue[i].get_str()), 0) >> txout;
|
||||
prevouts.push_back(std::move(txout));
|
||||
}
|
||||
return prevouts;
|
||||
}
|
||||
|
||||
static CScriptWitness ScriptWitnessFromJSON(const UniValue& univalue)
|
||||
{
|
||||
assert(univalue.isArray());
|
||||
CScriptWitness scriptwitness;
|
||||
for (size_t i = 0; i < univalue.size(); ++i) {
|
||||
auto bytes = ParseHex(univalue[i].get_str());
|
||||
scriptwitness.stack.push_back(std::move(bytes));
|
||||
}
|
||||
return scriptwitness;
|
||||
}
|
||||
|
||||
/* Test simple (successful) usage of bitcoinconsensus_verify_script */
|
||||
BOOST_AUTO_TEST_CASE(bitcoinconsensus_verify_script_returns_true)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue