Skip to content

Commit

Permalink
Skip orders not existing in orders_set instead of using expect. (#1430)
Browse files Browse the repository at this point in the history
* Skip orders not existing in orders_set instead of using expect.

* Ignore RUSTSEC-2022-0040.

Co-authored-by: Artem Vitae <artem@vitae.com>
  • Loading branch information
artemii235 and Artem Vitae authored Aug 3, 2022
1 parent ae79066 commit 7cf104a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
2 changes: 2 additions & 0 deletions deny.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,11 @@ notice = "warn"

# RUSTSEC-2021-0113 is related to metrics-util crate that is not actively used for now despite being still present in deps tree
# RUSTSEC-2020-0071 is related to time crate, which is used only by chrono in our deps tree, remove when https://github.com/chronotope/chrono/issues/700 is resolved
# RUSTSEC-2022-0040 is related to owning-ref, which seems unmaintained. We need to find a way to get rid of it. https://github.com/KomodoPlatform/atomicDEX-API/issues/1429
ignore = [
"RUSTSEC-2021-0113",
"RUSTSEC-2020-0071",
"RUSTSEC-2022-0040",
#"RUSTSEC-0000-0000",
]
# Threshold for security vulnerabilities, any vulnerability with a CVSS score
Expand Down
16 changes: 11 additions & 5 deletions mm2src/mm2_main/src/lp_ordermatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use coins::utxo::{compressed_pub_key_from_priv_raw, ChecksumType, UtxoAddressFor
use coins::{coin_conf, find_pair, lp_coinfind, BalanceTradeFeeUpdatedHandler, CoinProtocol, CoinsContext,
FeeApproxStage, MmCoinEnum};
use common::executor::{spawn, Timer};
use common::log::{error, LogOnError};
use common::log::{error, warn, LogOnError};
use common::time_cache::TimeCache;
use common::{bits256, log, new_uuid, now_ms, spawn_abortable, AbortOnDropHandle};
use crypto::privkey::SerializableSecp256k1Keypair;
Expand Down Expand Up @@ -625,10 +625,16 @@ fn get_pubkeys_orders(orderbook: &Orderbook, base: String, rel: String) -> GetPu
let mut protocol_infos = HashMap::new();
let mut conf_infos = HashMap::new();
for uuid in orders {
let order = orderbook
.order_set
.get(uuid)
.expect("Orderbook::ordered contains an uuid that is not in Orderbook::order_set");
let order = match orderbook.order_set.get(uuid) {
Some(o) => o,
None => {
warn!(
"Orderbook::ordered contains uuid {} that is not in Orderbook::order_set",
uuid
);
continue;
},
};
let uuids = uuids_by_pubkey.entry(order.pubkey.clone()).or_insert_with(Vec::new);
protocol_infos.insert(order.uuid, order.base_rel_proto_info());
if let Some(info) = order.conf_settings {
Expand Down

0 comments on commit 7cf104a

Please sign in to comment.