[bitcoin/bitcoin] Dandelion transaction relay (BIP 156) (#13947)

sdaftuar commented on this pull request.

> +
+ if (pfrom->m_cache_dandelion_size > MAX_DANDELION_CACHE_SZ) {
+ LogPrint(BCLog::DANDELION, «full cache (size: %d)\n», pfrom->m_cache_dandelion_size);
+ return true;
+ }
+ LOCK(cs_main);
+ if (AlreadyHave(CInv{MSG_TX, tx->GetHash()})) {
+ LogPrint(BCLog::DANDELION, «already have\n»);
+ return true;
+ }
+ CValidationState state;
+ bool missing_inputs;
+ if (AcceptToMemoryPool(mempool, state, tx, &missing_inputs, nullptr /* lRemovedTxn */, false /* bypass_limits */, 0 /* nAbsurdFee */, true /* test_accept */)) {
+ RelayDandelionTransaction(mempool, pfrom, tx, msgMaker, connman);

I think we should queue transactions for relay to a peer, rather than doing a direct send as is done here. Otherwise transaction relay can fill up our send buffers and delay block relay.

Further our current transaction relay system batches transactions for relay and, at each broadcast time, we sort the to-be-relayed transactions for the purposes of prioritising transactions that have fewer ancestors and higher feerate. I think being able to prioritise transactions with higher feerate for relay is probably useful (to prevent low-feerate transactions from harming propagation times of higher feerate transactions).

Добавить комментарий