mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-16 13:01:19 +02:00
Merge dd5f5713bc into merged_master (Bitcoin PR bitcoin/bitcoin#28391)
This commit is contained in:
commit
d55f2b27cb
14 changed files with 113 additions and 94 deletions
|
|
@ -649,8 +649,9 @@ public:
|
|||
{
|
||||
if (!m_node.mempool) return false;
|
||||
LOCK(m_node.mempool->cs);
|
||||
auto it = m_node.mempool->GetIter(txid);
|
||||
return it && (*it)->GetCountWithDescendants() > 1;
|
||||
const auto entry{m_node.mempool->GetEntry(Txid::FromUint256(txid))};
|
||||
if (entry == nullptr) return false;
|
||||
return entry->GetCountWithDescendants() > 1;
|
||||
}
|
||||
bool broadcastTransaction(const CTransactionRef& tx,
|
||||
const CAmount& max_tx_fee,
|
||||
|
|
@ -704,9 +705,9 @@ public:
|
|||
LockPoints lp;
|
||||
std::set<std::pair<uint256, COutPoint>> setPeginsSpent;
|
||||
CTxMemPoolEntry entry(tx, 0, 0, 0, 0, false, 0, lp, setPeginsSpent);
|
||||
const CTxMemPool::Limits& limits{m_node.mempool->m_limits};
|
||||
LOCK(m_node.mempool->cs);
|
||||
return m_node.mempool->CalculateMemPoolAncestors(entry, limits).has_value();
|
||||
std::string err_string;
|
||||
return m_node.mempool->CheckPackageLimits({tx}, entry.GetTxSize(), err_string);
|
||||
}
|
||||
CFeeRate estimateSmartFee(int num_blocks, bool conservative, FeeCalculation* calc) override
|
||||
{
|
||||
|
|
@ -808,7 +809,7 @@ public:
|
|||
{
|
||||
if (!m_node.mempool) return;
|
||||
LOCK2(::cs_main, m_node.mempool->cs);
|
||||
for (const CTxMemPoolEntry& entry : m_node.mempool->mapTx) {
|
||||
for (const CTxMemPoolEntry& entry : m_node.mempool->entryAll()) {
|
||||
notifications.transactionAddedToMempool(entry.GetSharedTx());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -241,7 +241,7 @@ void BlockAssembler::onlyUnconfirmed(CTxMemPool::setEntries& testSet)
|
|||
{
|
||||
for (CTxMemPool::setEntries::iterator iit = testSet.begin(); iit != testSet.end(); ) {
|
||||
// Only test txs not already in the block
|
||||
if (inBlock.count(*iit)) {
|
||||
if (inBlock.count((*iit)->GetSharedTx()->GetHash())) {
|
||||
testSet.erase(iit++);
|
||||
} else {
|
||||
iit++;
|
||||
|
|
@ -282,7 +282,7 @@ void BlockAssembler::AddToBlock(CTxMemPool::txiter iter)
|
|||
++nBlockTx;
|
||||
nBlockSigOpsCost += iter->GetSigOpCost();
|
||||
nFees += iter->GetFee();
|
||||
inBlock.insert(iter);
|
||||
inBlock.insert(iter->GetSharedTx()->GetHash());
|
||||
|
||||
bool fPrintPriority = gArgs.GetBoolArg("-printpriority", DEFAULT_PRINTPRIORITY);
|
||||
if (fPrintPriority) {
|
||||
|
|
@ -351,7 +351,7 @@ void BlockAssembler::addPackageTxs(const CTxMemPool& mempool, int& nPackagesSele
|
|||
// because some of their txs are already in the block
|
||||
indexed_modified_transaction_set mapModifiedTx;
|
||||
// Keep track of entries that failed inclusion, to avoid duplicate work
|
||||
CTxMemPool::setEntries failedTx;
|
||||
std::set<Txid> failedTx;
|
||||
|
||||
CTxMemPool::indexed_transaction_set::index<confidential_score>::type::iterator mi = mempool.mapTx.get<confidential_score>().begin();
|
||||
CTxMemPool::txiter iter;
|
||||
|
|
@ -379,7 +379,7 @@ void BlockAssembler::addPackageTxs(const CTxMemPool& mempool, int& nPackagesSele
|
|||
if (mi != mempool.mapTx.get<confidential_score>().end()) {
|
||||
auto it = mempool.mapTx.project<0>(mi);
|
||||
assert(it != mempool.mapTx.end());
|
||||
if (mapModifiedTx.count(it) || inBlock.count(it) || failedTx.count(it)) {
|
||||
if (mapModifiedTx.count(it) || inBlock.count(it->GetSharedTx()->GetHash()) || failedTx.count(it->GetSharedTx()->GetHash())) {
|
||||
++mi;
|
||||
continue;
|
||||
}
|
||||
|
|
@ -419,7 +419,7 @@ void BlockAssembler::addPackageTxs(const CTxMemPool& mempool, int& nPackagesSele
|
|||
|
||||
// We skip mapTx entries that are inBlock, and mapModifiedTx shouldn't
|
||||
// contain anything that is inBlock.
|
||||
assert(!inBlock.count(iter));
|
||||
assert(!inBlock.count(iter->GetSharedTx()->GetHash()));
|
||||
|
||||
uint64_t packageSize = iter->GetSizeWithAncestors();
|
||||
CAmount packageFees = iter->GetModFeesWithAncestors();
|
||||
|
|
@ -449,7 +449,7 @@ void BlockAssembler::addPackageTxs(const CTxMemPool& mempool, int& nPackagesSele
|
|||
// we must erase failed entries so that we can consider the
|
||||
// next best entry on the next loop iteration
|
||||
mapModifiedTx.get<confidential_score>().erase(modit);
|
||||
failedTx.insert(iter);
|
||||
failedTx.insert(iter->GetSharedTx()->GetHash());
|
||||
}
|
||||
|
||||
++nConsecutiveFailed;
|
||||
|
|
@ -471,7 +471,7 @@ void BlockAssembler::addPackageTxs(const CTxMemPool& mempool, int& nPackagesSele
|
|||
if (!TestPackageTransactions(ancestors)) {
|
||||
if (fUsingModified) {
|
||||
mapModifiedTx.get<confidential_score>().erase(modit);
|
||||
failedTx.insert(iter);
|
||||
failedTx.insert(iter->GetSharedTx()->GetHash());
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@ private:
|
|||
uint64_t nBlockTx;
|
||||
uint64_t nBlockSigOpsCost;
|
||||
CAmount nFees;
|
||||
CTxMemPool::setEntries inBlock;
|
||||
std::unordered_set<Txid, SaltedTxidHasher> inBlock;
|
||||
|
||||
// Chain context for the block
|
||||
int nHeight;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue