Module agora.node.TransactionRelayer
TransactionRelayer is responsible for storing transactions, and relaying
some of them to all known network clients periodically. The current
implementation relays transactions with the highest fees.
The class contains several optimizations
- Transaction hashes are stored in a RedBlackTree sorted by the
transaction fee. By doing so, getting the N transactions with
the highest fees can be done quickly.
- Transaction fee is calculated, and stored as part of the key
to avoid the expensive fee recalculation every time an addition/remove
operation is done on the RedBlackTree
- Separate hash set is used to be able to quickly decide whether a
transaction is in the RedBlackTree or not
- Only the transaction hash(and not the entire transaction) is
stored in the RedBlackTree to reduce memory usage
- There is a periodic cleanup of old entries in the Hash set and in
the RedBlackTree to reduce memory usage
Interfaces
Name | Description |
TransactionRelayer
|
Transaction relayer interface, that accepts transactions and relays
them to known network clients.
|
Classes
Name | Description |
TransactionRelayerFeeImp
|
Transaction relayer implementation, that relays transactions with the highest
fees first.
|
Aliases
Name | Type | Description |
GetFeeRateDg
|
nothrow @safe string delegate(in ref Transaction, out Amount)
|
Returns the fee rate for a transaction (total fees / tx size)
|