-
Notifications
You must be signed in to change notification settings - Fork 101
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
[r2r] Allow bestorders RPC execution with number #1327
Conversation
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.
Good work! I have only one note for now :)
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.
Thanks @laruh for prompt fixes!
If I understand correctly from code, second approach, mentioned here #1314 (comment) was implemented eventually?
Hi!
|
@ozkanonur Could you take a look too, please? 🙂 |
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.
LGTM. Great work 🔥
Only one note. In the codeblocks, I suggest you to not create permament mutable variables to avoid future bugs or unexpected issues behaviour. I prefer to create mut variables as temporary by shadowing them as immutable right after where I no longer need to update them.
An example:
@@ -191,6 +191,12 @@ pub fn process_best_orders_p2p_request_by_number(
BestOrdersAction::Sell => result.insert(pair.0, best_orders),
};
}
+
+ // Drop mutability of result, protocol_infos and conf_infos
+ let result = result;
+ let protocol_infos = protocol_infos;
+ let conf_infos = conf_infos;
+
let response = BestOrdersP2PRes {
orders: result,
protocol_infos,
Good idea! Done |
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.
🔥
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.
👍
Implementation of the code to solve the problem "Allow bestorders RPC execution without volume argument" #1314
Changes have been made:
1.best_orders.rs
Function
process_best_orders_p2p_request_by_number
was addedIn fn
best_orders_rpc_v2
instead ofreq: BestOrdersRequest
there isreq: BestOrdersRequestV2
2.lp_ordermatch.rs
OrdermatchRequest::BestOrdersByNumber
was added, it is matched in functionprocess_peer_request
, result goes into the functionbest_orders::process_best_orders_p2p_request_by_number
3.tests added in best_orders_tests