Serve condition-scoped portfolio valuations from marked holdings
This commit is contained in:
@@ -7,6 +7,10 @@ pub(crate) fn identifier(id: &str) -> Result<()> {
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
pub(crate) fn hex_id(id: &str, digits: usize) -> bool {
|
||||
id.len() == 2 + digits && id.starts_with("0x") && id[2..].bytes().all(|b| b.is_ascii_hexdigit())
|
||||
}
|
||||
|
||||
pub(crate) fn amount(n: i64) -> Result<()> {
|
||||
ensure!((1..=1_000_000_000).contains(&n), "invalid amount");
|
||||
Ok(())
|
||||
@@ -61,9 +65,7 @@ pub(crate) fn directory_selector(
|
||||
ensure!(n > 0, "invalid event_id");
|
||||
keys.push(n.to_string());
|
||||
} else {
|
||||
if id.starts_with("0x")
|
||||
&& !(id.len() == 66 && id[2..].bytes().all(|b| b.is_ascii_hexdigit()))
|
||||
{
|
||||
if id.starts_with("0x") && !hex_id(id, 64) {
|
||||
// Locally listed condition IDs may legitimately use a short 0x prefix.
|
||||
let listed: bool = db.query_row(
|
||||
"SELECT EXISTS(SELECT 1 FROM markets WHERE id=?1)",
|
||||
|
||||
Reference in New Issue
Block a user