-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Improve transaction relay logic #4985
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
c3805a7
36dddfa
99a63a0
e048a41
3c0dbeb
88c0074
029d64c
a1218af
f67f346
3863b01
8b43ea8
23636d1
7096d0a
643ca1a
f0170d3
8742e3b
e6f2597
0f71e1c
31a18f8
58a5797
05e4164
ff27e9e
5d1ab36
43d8ab1
c7e08bc
3054f5a
c9eed68
3ac1a8a
0940acd
00e1945
77138fc
c2f600c
29dbd50
3d741e1
fb0e201
f982d93
284399b
03f9d0f
31e982a
0641f77
01bd73b
f3e3199
b056f25
0bbb61a
b008dbc
022142f
be52629
12af9f1
c1866d1
79fb1cc
b5624fe
a35aab0
9595d8c
eeb1277
91d0867
3c5e9cf
2ca015e
65303b3
e5233f2
8f48d64
d5ba2c6
dcc3ca5
d3a9522
9082414
96f9219
c94bf7d
9fe23dc
e96745f
1cd33b8
158c285
5b09745
e8c0d7b
76dd4e1
47da138
93b9a6d
0855726
1fed810
60a85fe
8940cc7
bfb94f4
461a7cd
24ec8b6
3dd76a9
7b0402b
de851fd
00490df
57edd8a
3951f87
c1a4f07
3d0597a
16362dc
a958bed
765ccfe
08134a0
684016a
16ae8e1
d360a6c
2eb90c0
0c0362f
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 |
|---|---|---|
|
|
@@ -18,6 +18,7 @@ | |
| //============================================================================== | ||
|
|
||
| #include <xrpld/app/misc/HashRouter.h> | ||
| #include <xrpld/core/Config.h> | ||
|
|
||
| namespace ripple { | ||
|
|
||
|
|
@@ -33,7 +34,7 @@ HashRouter::emplace(uint256 const& key) -> std::pair<Entry&, bool> | |
| } | ||
|
|
||
| // See if any supressions need to be expired | ||
| expire(suppressionMap_, holdTime_); | ||
| expire(suppressionMap_, setup_.holdTime); | ||
|
|
||
| return std::make_pair( | ||
| std::ref(suppressionMap_.emplace(key, Entry()).first->second), true); | ||
|
|
@@ -122,10 +123,45 @@ HashRouter::shouldRelay(uint256 const& key) | |
|
|
||
| auto& s = emplace(key).first; | ||
|
|
||
| if (!s.shouldRelay(suppressionMap_.clock().now(), holdTime_)) | ||
| if (!s.shouldRelay(suppressionMap_.clock().now(), setup_.relayTime)) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we have a comment here why
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The parameter in |
||
| return {}; | ||
|
|
||
| return s.releasePeerSet(); | ||
| } | ||
|
|
||
| HashRouter::Setup | ||
| setup_HashRouter(Config const& config) | ||
| { | ||
| using namespace std::chrono; | ||
|
|
||
| HashRouter::Setup setup; | ||
| auto const& section = config.section("hashrouter"); | ||
|
|
||
| std::int32_t tmp; | ||
|
|
||
| if (set(tmp, "hold_time", section)) | ||
| { | ||
| if (tmp < 12) | ||
| Throw<std::runtime_error>( | ||
| "HashRouter hold time must be at least 12 seconds (the " | ||
| "approximate validation time for three ledgers)."); | ||
| setup.holdTime = seconds(tmp); | ||
| } | ||
| if (set(tmp, "relay_time", section)) | ||
| { | ||
| if (tmp < 8) | ||
| Throw<std::runtime_error>( | ||
| "HashRouter relay time must be at least 8 seconds (the " | ||
| "approximate validation time for two ledgers)."); | ||
| setup.relayTime = seconds(tmp); | ||
| } | ||
| if (setup.relayTime > setup.holdTime) | ||
| { | ||
| Throw<std::runtime_error>( | ||
| "HashRouter relay time must be less than or equal to hold time"); | ||
| } | ||
|
|
||
| return setup; | ||
| } | ||
|
|
||
| } // namespace ripple | ||
Uh oh!
There was an error while loading. Please reload this page.
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.
could this produce different transaction
orderset compared to the old code ? If so, shouldn't this be amendment-gated ?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.
No, because this transaction is only relevant in the context of
NetworkOPsImp::apply, which only handles the open ledger. Ordering rules are enforced, but don't matter the way they do in building a consensus ledger. Also, the one use is inLedgerMaster::popAccountTransaction, and is done onmHeldTransactions, which are transactions that are held for retry into the open ledger. Again, nothing to do with consensus.