-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Advice for preventing consensus node from Garbage transactions #478
Comments
They actually are sorted after each block is persisted and added back to the chain in the order by fee per byte: https://github.com/neo-project/neo/blob/master/neo/Ledger/Blockchain.cs#L390-L397 |
Superboyiii refers to the fact that although transactions are prioritized when they are filled into a block, they are not prioritized when they are transmitted through the network. Therefore, when the network is extremely busy, the transaction with transaction fee cannot reach the consensus node preferentially. The improved solution is that transactions are sorted according to network fees when they are relayed. Although this improvement does not bring any benefits when the network is idle, it can show changes when the network is extremely busy. |
Wouldn’t you have to batch incoming transactions and delay relaying them slightly in order to prioritize them. How would that work exactly? Maybe there should be a pool before the mempool where transactions are sorted by fee and have a lesser lightweight verification done that doesn’t require fully reverifying the tx on each block so that transactions that won’t make it into the next block don’t get pointlessly reverified wasting resources on node that could be used to do better sorting before relaying new transactions. |
The mem-pool is a Dictionary<UInt256, Transaction>. It does not hold sorted information. Everytime it is sorted, the transactions over 50,000 records will be discarded. After that all transactions are still disordered. |
I thought about changing the mempool data structure to be a sorted structure (a balanced tree would likely be better); not sure a queue is the best though. I haven’t had time to work on such changes, but it is one of the things that should be done. |
Also, as it is all transactions that make it into the mempool are verified; I’m pretty sure other parts of the code need anything that make it into the mempool to be verified; seems like a pool before the mempool that uses a SortedSet/SortedDictionary could possibly work. |
A sorted set would be faster than a queue when adding new transaction. I use a queue to describe the idea. Does not have to be a queue. |
If I get time I will work on rewriting the way the mempool works to reduce load and be able to improve how transactions propagate. |
While the transaction messages in the |
As I see, I find there's sorting mechanism in consensus nodes' mempool for transactions order by network fee but it doesn't work effectively when the mainnet is crowded by massive free transactions. I think it's
mostly because of that every ordinary node has no mechanism for sorting transaction by network fee in it's local when transactions are crowded in TCP/IP piping. Every transaction now is only received, verified, relayed by nodes to their peers, finally sent to consenus nodes' mempool. So if the transctions could be sorted before relayed, block stagnation could be solved.
The text was updated successfully, but these errors were encountered: