mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 12:02:48 +01:00
merge bitcoin#19753: don't add AlreadyHave transactions to recentRejects
Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
This commit is contained in:
parent
4acad29789
commit
2d64620306
@ -3626,10 +3626,25 @@ void PeerManagerImpl::ProcessMessage(
|
||||
|
||||
LOCK2(cs_main, g_cs_orphans);
|
||||
|
||||
if (AlreadyHave(inv)) {
|
||||
if (pfrom.HasPermission(PF_FORCERELAY)) {
|
||||
// Always relay transactions received from peers with forcerelay permission, even
|
||||
// if they were already in the mempool,
|
||||
// allowing the node to function as a gateway for
|
||||
// nodes hidden behind it.
|
||||
if (!m_mempool.exists(tx.GetHash())) {
|
||||
LogPrintf("Not relaying non-mempool transaction %s from forcerelay peer=%d\n", tx.GetHash().ToString(), pfrom.GetId());
|
||||
} else {
|
||||
LogPrintf("Force relaying tx %s from peer=%d\n", tx.GetHash().ToString(), pfrom.GetId());
|
||||
RelayTransaction(tx.GetHash());
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
TxValidationState state;
|
||||
|
||||
if (!AlreadyHave(inv) && AcceptToMemoryPool(m_chainman.ActiveChainstate(), m_mempool, state, ptx,
|
||||
false /* bypass_limits */)) {
|
||||
if (AcceptToMemoryPool(m_chainman.ActiveChainstate(), m_mempool, state, ptx, false /* bypass_limits */)) {
|
||||
// Process custom txes, this changes AlreadyHave to "true"
|
||||
if (nInvType == MSG_DSTX) {
|
||||
LogPrint(BCLog::COINJOIN, "DSTX -- Masternode transaction accepted, txid=%s, peer=%d\n",
|
||||
@ -3700,19 +3715,6 @@ void PeerManagerImpl::ProcessMessage(
|
||||
if (RecursiveDynamicUsage(*ptx) < 100000) {
|
||||
AddToCompactExtraTransactions(ptx);
|
||||
}
|
||||
|
||||
if (pfrom.HasPermission(PF_FORCERELAY)) {
|
||||
// Always relay transactions received from peers with forcerelay permission, even
|
||||
// if they were already in the mempool,
|
||||
// allowing the node to function as a gateway for
|
||||
// nodes hidden behind it.
|
||||
if (!m_mempool.exists(tx.GetHash())) {
|
||||
LogPrintf("Not relaying non-mempool transaction %s from forcerelay peer=%d\n", tx.GetHash().ToString(), pfrom.GetId());
|
||||
} else {
|
||||
LogPrintf("Force relaying tx %s from peer=%d\n", tx.GetHash().ToString(), pfrom.GetId());
|
||||
RelayTransaction(tx.GetHash());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If a tx has been detected by m_recent_rejects, we will have reached
|
||||
|
@ -143,11 +143,20 @@ class P2PPermissionsTests(BitcoinTestFramework):
|
||||
self.log.debug("Check that node[1] will not send an invalid tx to node[0]")
|
||||
tx.vout[0].nValue += 1
|
||||
txid = tx.rehash()
|
||||
# Send the transaction twice. The first time, it'll be rejected by ATMP because it conflicts
|
||||
# with a mempool transaction. The second time, it'll be in the recentRejects filter.
|
||||
p2p_rebroadcast_wallet.send_txs_and_test(
|
||||
[tx],
|
||||
self.nodes[1],
|
||||
success=False,
|
||||
reject_reason='Not relaying non-mempool transaction {} from forcerelay peer=0'.format(txid),
|
||||
reject_reason='{} from peer=0 was not accepted: txn-mempool-conflict'.format(txid)
|
||||
)
|
||||
|
||||
p2p_rebroadcast_wallet.send_txs_and_test(
|
||||
[tx],
|
||||
self.nodes[1],
|
||||
success=False,
|
||||
reject_reason='Not relaying non-mempool transaction {} from forcerelay peer=0'.format(txid)
|
||||
)
|
||||
|
||||
def checkpermission(self, args, expectedPermissions, whitelisted):
|
||||
|
Loading…
Reference in New Issue
Block a user