-
Notifications
You must be signed in to change notification settings - Fork 492
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
txnsync: Use dynamic maxEncodedTransactionGroups #3168
txnsync: Use dynamic maxEncodedTransactionGroups #3168
Conversation
txnsync/service.go
Outdated
@@ -51,6 +51,13 @@ func MakeTransactionSyncService(log logging.Logger, conn NodeConnector, isRelay | |||
} | |||
s.state.service = s | |||
s.state.xorBuilder.MaxIterations = 10 | |||
if cfg.TxPoolSize > maxEncodedTransactionGroups { |
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.
This looks correct, but think it would be cleaner if you'll move all that logic into a single method which would be called by both init()
as well as from here.
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.
what is init()?
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.
init methods are called when the package is loaded. In this case, instead of initializing the global variables where they are declared, call
func init() {
setTransactionSyncVariables(config.GetDefaultLocal())
}
...
func setTransactionSyncVariables(cfg config.Local) {
if cfg.TxPoolSize < maxEncodedTransactionGroups {
return
}
maxEncodedTransactionGroups = cfg.TxPoolSize
maxEncodedTransactionGroupEntries = cfg.TxPoolSize
maxBitmaskSize = (maxEncodedTransactionGroupEntries+7)/8 + 1
maxSignatureBytes = maxEncodedTransactionGroupEntries * len(crypto.Signature{})
maxAddressBytes = maxEncodedTransactionGroupEntries * crypto.DigestSize
maxBloomFilterSize = cfg.TxPoolSize * 5 // 32 bit xor uses slightly more than 4 bytes/element.
maxEncodedTransactionGroupBytes = cfg.TxPoolSize * 10000 // assume each transaction takes 10KB, as a worst-case-scenario for bounding purposes only.
}
Codecov Report
@@ Coverage Diff @@
## master #3168 +/- ##
==========================================
- Coverage 43.77% 43.77% -0.01%
==========================================
Files 391 391
Lines 86880 86891 +11
==========================================
- Hits 38036 38033 -3
- Misses 42810 42820 +10
- Partials 6034 6038 +4
Continue to review full report at Codecov.
|
…)" This reverts commit 21c752e.
Change constants in the txnsync around message size limits into variables based on maxTxPoolSize. This will allow for support of larger message sizes when dealing with larger load. Reran existing tests
Summary
Change constants in the txnsync around message size limits into variables based on maxTxPoolSize. This will allow for support of larger message sizes when dealing with larger load.
Test Plan
Reran existing tests