mirror of
https://github.com/Retropex/bitcoin.git
synced 2025-05-12 19:20:42 +02:00
QA: Adapt unit tests to not care about permitbarepubkey default
This commit is contained in:
parent
0b07575691
commit
4d0469fad9
@ -22,6 +22,7 @@
|
|||||||
static bool IsStandardTx(const CTransaction& tx, bool permit_bare_multisig, std::string& reason)
|
static bool IsStandardTx(const CTransaction& tx, bool permit_bare_multisig, std::string& reason)
|
||||||
{
|
{
|
||||||
const kernel::MemPoolOptions opts{
|
const kernel::MemPoolOptions opts{
|
||||||
|
.permit_bare_pubkey = true,
|
||||||
.permit_bare_multisig = permit_bare_multisig,
|
.permit_bare_multisig = permit_bare_multisig,
|
||||||
};
|
};
|
||||||
return IsStandardTx(tx, opts, reason);
|
return IsStandardTx(tx, opts, reason);
|
||||||
@ -30,6 +31,7 @@ static bool IsStandardTx(const CTransaction& tx, bool permit_bare_multisig, std:
|
|||||||
static bool IsStandardTx(const CTransaction& tx, std::string& reason)
|
static bool IsStandardTx(const CTransaction& tx, std::string& reason)
|
||||||
{
|
{
|
||||||
kernel::MemPoolOptions opts{
|
kernel::MemPoolOptions opts{
|
||||||
|
.permit_bare_pubkey = true,
|
||||||
.permit_bare_multisig = true,
|
.permit_bare_multisig = true,
|
||||||
};
|
};
|
||||||
if (!IsStandardTx(tx, opts, reason)) return false;
|
if (!IsStandardTx(tx, opts, reason)) return false;
|
||||||
|
@ -796,6 +796,8 @@ BOOST_AUTO_TEST_CASE(test_IsStandard)
|
|||||||
CKey key = GenerateRandomKey();
|
CKey key = GenerateRandomKey();
|
||||||
t.vout[0].scriptPubKey = GetScriptForDestination(PKHash(key.GetPubKey()));
|
t.vout[0].scriptPubKey = GetScriptForDestination(PKHash(key.GetPubKey()));
|
||||||
|
|
||||||
|
g_mempool_opts.permit_bare_pubkey = true;
|
||||||
|
|
||||||
constexpr auto CheckIsStandard = [](const auto& t) {
|
constexpr auto CheckIsStandard = [](const auto& t) {
|
||||||
std::string reason;
|
std::string reason;
|
||||||
BOOST_CHECK(IsStandardTx(CTransaction{t}, g_mempool_opts, reason));
|
BOOST_CHECK(IsStandardTx(CTransaction{t}, g_mempool_opts, reason));
|
||||||
|
@ -54,7 +54,7 @@ BOOST_FIXTURE_TEST_CASE(tx_mempool_block_doublespend, Dersig100Setup)
|
|||||||
spends[i].vin[0].prevout.n = 0;
|
spends[i].vin[0].prevout.n = 0;
|
||||||
spends[i].vout.resize(1);
|
spends[i].vout.resize(1);
|
||||||
spends[i].vout[0].nValue = 11*CENT;
|
spends[i].vout[0].nValue = 11*CENT;
|
||||||
spends[i].vout[0].scriptPubKey = scriptPubKey;
|
spends[i].vout[0].scriptPubKey = GetScriptForDestination(PKHash(coinbaseKey.GetPubKey()));
|
||||||
|
|
||||||
// Sign:
|
// Sign:
|
||||||
std::vector<unsigned char> vchSig;
|
std::vector<unsigned char> vchSig;
|
||||||
|
@ -864,7 +864,7 @@ BOOST_FIXTURE_TEST_CASE(CreateWallet, TestChain100Setup)
|
|||||||
m_coinbase_txns.push_back(CreateAndProcessBlock({}, GetScriptForRawPubKey(coinbaseKey.GetPubKey())).vtx[0]);
|
m_coinbase_txns.push_back(CreateAndProcessBlock({}, GetScriptForRawPubKey(coinbaseKey.GetPubKey())).vtx[0]);
|
||||||
auto block_tx = TestSimpleSpend(*m_coinbase_txns[0], 0, coinbaseKey, GetScriptForRawPubKey(key.GetPubKey()));
|
auto block_tx = TestSimpleSpend(*m_coinbase_txns[0], 0, coinbaseKey, GetScriptForRawPubKey(key.GetPubKey()));
|
||||||
m_coinbase_txns.push_back(CreateAndProcessBlock({block_tx}, GetScriptForRawPubKey(coinbaseKey.GetPubKey())).vtx[0]);
|
m_coinbase_txns.push_back(CreateAndProcessBlock({block_tx}, GetScriptForRawPubKey(coinbaseKey.GetPubKey())).vtx[0]);
|
||||||
auto mempool_tx = TestSimpleSpend(*m_coinbase_txns[1], 0, coinbaseKey, GetScriptForRawPubKey(key.GetPubKey()));
|
auto mempool_tx = TestSimpleSpend(*m_coinbase_txns[1], 0, coinbaseKey, GetScriptForDestination(PKHash(key.GetPubKey())));
|
||||||
BOOST_CHECK(m_node.chain->broadcastTransaction(MakeTransactionRef(mempool_tx), DEFAULT_TRANSACTION_MAXFEE, false, error));
|
BOOST_CHECK(m_node.chain->broadcastTransaction(MakeTransactionRef(mempool_tx), DEFAULT_TRANSACTION_MAXFEE, false, error));
|
||||||
|
|
||||||
|
|
||||||
@ -906,7 +906,7 @@ BOOST_FIXTURE_TEST_CASE(CreateWallet, TestChain100Setup)
|
|||||||
m_coinbase_txns.push_back(CreateAndProcessBlock({}, GetScriptForRawPubKey(coinbaseKey.GetPubKey())).vtx[0]);
|
m_coinbase_txns.push_back(CreateAndProcessBlock({}, GetScriptForRawPubKey(coinbaseKey.GetPubKey())).vtx[0]);
|
||||||
block_tx = TestSimpleSpend(*m_coinbase_txns[2], 0, coinbaseKey, GetScriptForRawPubKey(key.GetPubKey()));
|
block_tx = TestSimpleSpend(*m_coinbase_txns[2], 0, coinbaseKey, GetScriptForRawPubKey(key.GetPubKey()));
|
||||||
m_coinbase_txns.push_back(CreateAndProcessBlock({block_tx}, GetScriptForRawPubKey(coinbaseKey.GetPubKey())).vtx[0]);
|
m_coinbase_txns.push_back(CreateAndProcessBlock({block_tx}, GetScriptForRawPubKey(coinbaseKey.GetPubKey())).vtx[0]);
|
||||||
mempool_tx = TestSimpleSpend(*m_coinbase_txns[3], 0, coinbaseKey, GetScriptForRawPubKey(key.GetPubKey()));
|
mempool_tx = TestSimpleSpend(*m_coinbase_txns[3], 0, coinbaseKey, GetScriptForDestination(PKHash(key.GetPubKey())));
|
||||||
BOOST_CHECK(m_node.chain->broadcastTransaction(MakeTransactionRef(mempool_tx), DEFAULT_TRANSACTION_MAXFEE, false, error));
|
BOOST_CHECK(m_node.chain->broadcastTransaction(MakeTransactionRef(mempool_tx), DEFAULT_TRANSACTION_MAXFEE, false, error));
|
||||||
m_node.validation_signals->SyncWithValidationInterfaceQueue();
|
m_node.validation_signals->SyncWithValidationInterfaceQueue();
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user