-
Notifications
You must be signed in to change notification settings - Fork 1.7k
TransactionQueue improvements #1966
Comments
My thoughts: // List of all transactions
transactions: HashMap<Address, BTreeMap<U256, Rc<VerifiedTransaction>>>
// Transaction and it's location.
// We store copies of handles to easily find transactions in queues (for removal / re-insertion)
LocalizedTransaction {
transaction: Rc<VerifiedTransaction>, // Seems it's not needed.
location: Current(TransactionHandle)/Future(FutureTransactionHandle)
}
// Current (with limit)
// Ordered by:
// 1. Sender priority (local transactions / reimported transactions / penalized transactions)
// 2. Nonce Height (nonce - state_nonce)
// 3. Gas Price
// 4. Hash
current: PriorityQueue<TransactionHandle>
TransactionHandle {
transaction: Rc<VerifiedTransaction>,
nonce_height: U256,
priority: Local/RetractedBlock/External/GasLimitReached,
}
// Future (with limit)
// Ordered by:
// 1. Sender priority
// - stalled senders (occupies future, but transactions were not moved to Current for a long time) should be penalized
// 2. Nonce Height
// 3. Gas Price
// 4. Hash
future: PriorityQueue<FutureTransactionHandle>
FutureTransactionHandle {
transaction: Rc<VerifiedTransaction>,
nonce_height: U256,
priority: u64 //(block number at insertion time; higher is better)
}
/*
Notes:
1. Priorities (in C & F) always have to be updated for all transactions from particular sender.
2. Each import/removal needs to update `nonce_heights` (perhaps could be optimized if it doesn't change).
*/ |
+1. (Following closely the issue). Need an implementer? |
help always welcome :) |
Going to tackle point 1 (fixed storage). I think this would be a good opportunity to include a "node_data" column in the database for storing stuff like node sync security level and the state of the transaction queue on shutdown/startup. Our 1.6 database can already become incompatible with previous versions (as seen with the change in receipts format), so this will only serve to solidify an implicit one-way migration. |
+1 |
Idea: Current available queue is Run {
tx: some_tx,
run_number: previous_run.run_number + 1,
previous_cost: previous_run.total_cost(),
} where To order the |
Dirty hacky EDIT: Slightly less awful implementation here, it's still got serious problems though. From talking on IRC it looks like BTreeMap's not getting |
@Vurich If I understand correctly implemenetation of |
Yeah, it's dirty and hacky to prove the concept. I think the right way would be to store the average when it's created, since they're not edited after creation. I want to be able to drain the transactions when you |
I'm closing it, cause the new transaction queue was merged in #8074 |
The text was updated successfully, but these errors were encountered: