-
Notifications
You must be signed in to change notification settings - Fork 7
I172 service transactions garbage collector + more #328
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
Changes from all commits
3e7bc8f
02cb0a8
6e30091
f76a089
593bcfc
ec3ed17
9af27de
8e84bdb
55b5f65
9aa3a25
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,14 +1,21 @@ | ||||||
| ## Diamond Node Software 4.0.2 | ||||||
|
|
||||||
| OPTIONAL Update | ||||||
|
|
||||||
| New behavior for validator nodes as main feature | ||||||
| ### New behavior for validator nodes | ||||||
| - [Autoshutdown if a Node becomes a regular Node](https://github.com/DMDcoin/diamond-node/issues/322) | ||||||
| - [Remove empty blocks during key gen phases behaviour](https://github.com/DMDcoin/diamond-node/issues/327) | ||||||
| - [Service Transaction cleanup (garbage collect)](https://github.com/DMDcoin/diamond-node/issues/172) | ||||||
|
|
||||||
| Further stability improvements | ||||||
| ### RPC | ||||||
| - [Gas price from contracts](https://github.com/DMDcoin/diamond-node/issues/159) | ||||||
|
|
||||||
| ### Further stability improvements | ||||||
| - [FIXED: received transactions are getting pooled, if announced by another peer](https://github.com/DMDcoin/diamond-node/issues/304) | ||||||
| - [FIXED: dropped transactions are getting pooled](https://github.com/DMDcoin/diamond-node/issues/303) | ||||||
| - [FIXED: key generation can panic if faulty validators write malicious parts](https://github.com/DMDcoin/diamond-node/issues/100) | ||||||
| - [FIXED: already included transactions are refretched from peers](https://github.com/DMDcoin/diamond-node/issues/196) | ||||||
|
||||||
| - [FIXED: already included transactions are refretched from peers](https://github.com/DMDcoin/diamond-node/issues/196) | |
| - [FIXED: already included transactions are refetched from peers](https://github.com/DMDcoin/diamond-node/issues/196) |
Copilot
AI
Dec 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: "Gracefull" should be "Graceful".
| - [Gracefull Node Shutdown: increase to 15 seconds](https://github.com/DMDcoin/diamond-node/issues/321) | |
| - [Graceful Node Shutdown: increase to 15 seconds](https://github.com/DMDcoin/diamond-node/issues/321) |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -41,6 +41,8 @@ use crate::pool::{ | |||||
| verifier, PendingOrdering, PendingSettings, PrioritizationStrategy, | ||||||
| }; | ||||||
|
|
||||||
| use super::VerifiedTransaction; | ||||||
|
|
||||||
| type Listener = ( | ||||||
| LocalTransactionsList, | ||||||
| (listener::Notifier, listener::Logger), | ||||||
|
|
@@ -413,6 +415,17 @@ impl TransactionQueue { | |||||
| .collect() | ||||||
| } | ||||||
|
|
||||||
| /// Performs garbage collection of the pool of this transactionqueue for free service transactions. | ||||||
|
||||||
| /// Performs garbage collection of the pool of this transactionqueue for free service transactions. | |
| /// Performs garbage collection of the pool of this transaction queue for free service transactions. |
Copilot
AI
Dec 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Grammar error: "transaction" should be "transactions" (plural).
| /// Removes transaction that are not valid anymore. | |
| /// Removes transactions that are not valid anymore. |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -306,6 +306,10 @@ pub struct Client { | |||||
|
|
||||||
| shutdown: Arc<ShutdownManager>, | ||||||
|
|
||||||
| /// block number and block has of latest gc. | ||||||
|
||||||
| /// block number and block has of latest gc. | |
| /// block number and block hash of latest gc. |
Copilot
AI
Dec 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commented-out code should be removed. These debugging comments are not needed in production code.
| //client.check_garbage();.garbage_collect(Duration::from_secs(1)); |
Copilot
AI
Dec 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo in documentation comment: "servive" should be "service".
| /// Garbage collect invalid servive transactions from the transaction queue based on the given block header. | |
| /// Garbage collect invalid service transactions from the transaction queue based on the given block header. |
Copilot
AI
Dec 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo in comment: "loing" should be "long".
| // latest block could change during loing ongoing GCs. | |
| // latest block could change during long ongoing GCs. |
Copilot
AI
Dec 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo in comment: "placing" should be "running" or "happening".
| // but the GC blocks the tx queue, so it has to be placing fast. | |
| // but the GC blocks the tx queue, so it has to be running fast. |
Copilot
AI
Dec 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing whitespace at the end of this line should be removed.
| info!(target: "client", "collected garbage transaction from {:?}: {:?} reason: {:?}", tx.signed().sender(), tx.signed().hash, e); | |
| info!(target: "client", "collected garbage transaction from {:?}: {:?} reason: {:?}", tx.signed().sender(), tx.signed().hash, e); |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -420,6 +420,17 @@ impl Miner { | |||||
| self.service_transaction_checker.clone() | ||||||
| } | ||||||
|
|
||||||
| /// Performs garbage collection of the pool for free service transactions. | ||||||
| /// Removes transaction that are not valid anymore. | ||||||
|
||||||
| /// Removes transaction that are not valid anymore. | |
| /// Removes transactions that are not valid anymore. |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -14,7 +14,7 @@ | |||||
| // You should have received a copy of the GNU General Public License | ||||||
| // along with Parity. If not, see <http://www.gnu.org/licenses/>. | ||||||
|
|
||||||
| use log::{trace, warn}; | ||||||
| use log::{info, trace, warn}; | ||||||
| use std::{ | ||||||
| collections::{hash_map, BTreeSet, HashMap}, | ||||||
| slice, | ||||||
|
|
@@ -236,6 +236,44 @@ where | |||||
| } | ||||||
| } | ||||||
|
|
||||||
| /// Performs garbage collection of the pool for free service transactions. | ||||||
| /// Removes transaction that are not valid anymore. | ||||||
|
||||||
| /// Removes transaction that are not valid anymore. | |
| /// Removes transactions that are not valid anymore. |
Copilot
AI
Dec 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logic here is inverted. The function service_transaction_check returns true when a transaction is valid (see line 1590 in client.rs where Ok(_) => true), but here we're adding valid transactions to the removal list. This should be:
if !service_transaction_check(&tx.transaction) {
txs_to_remove.push(tx.hash().clone());
}This will correctly remove invalid transactions (when the check returns false).
| if service_transaction_check(&tx.transaction) { | |
| if !service_transaction_check(&tx.transaction) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing whitespace at the end of this line should be removed.