Pass spam filter option upstream
This commit is contained in:
parent
deb75ba3c7
commit
b0b966bc7d
|
@ -20,6 +20,7 @@ message BlockID {
|
||||||
message BlockRange {
|
message BlockRange {
|
||||||
BlockID start = 1;
|
BlockID start = 1;
|
||||||
BlockID end = 2;
|
BlockID end = 2;
|
||||||
|
uint64 spamFilterThreshold = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
// A TxFilter contains the information needed to identify a particular
|
// A TxFilter contains the information needed to identify a particular
|
||||||
|
|
|
@ -152,6 +152,7 @@ pub async fn download_chain(
|
||||||
start_height: u32,
|
start_height: u32,
|
||||||
end_height: u32,
|
end_height: u32,
|
||||||
mut prev_hash: Option<[u8; 32]>,
|
mut prev_hash: Option<[u8; 32]>,
|
||||||
|
max_cost: u32,
|
||||||
blocks_tx: Sender<Blocks>,
|
blocks_tx: Sender<Blocks>,
|
||||||
cancel: &'static Mutex<bool>,
|
cancel: &'static Mutex<bool>,
|
||||||
) -> anyhow::Result<()> {
|
) -> anyhow::Result<()> {
|
||||||
|
@ -170,6 +171,7 @@ pub async fn download_chain(
|
||||||
height: end_height as u64,
|
height: end_height as u64,
|
||||||
hash: vec![],
|
hash: vec![],
|
||||||
}),
|
}),
|
||||||
|
spam_filter_threshold: max_cost as u64,
|
||||||
};
|
};
|
||||||
*DOWNLOADED_BYTES.lock().unwrap() = 0;
|
*DOWNLOADED_BYTES.lock().unwrap() = 0;
|
||||||
*TRIAL_DECRYPTIONS.lock().unwrap() = 0;
|
*TRIAL_DECRYPTIONS.lock().unwrap() = 0;
|
||||||
|
@ -201,14 +203,19 @@ pub async fn download_chain(
|
||||||
prev_hash = Some(ph);
|
prev_hash = Some(ph);
|
||||||
for b in block.vtx.iter_mut() {
|
for b in block.vtx.iter_mut() {
|
||||||
b.actions.clear(); // don't need Orchard actions
|
b.actions.clear(); // don't need Orchard actions
|
||||||
|
let mut skipped = false;
|
||||||
for co in b.outputs.iter_mut() {
|
for co in b.outputs.iter_mut() {
|
||||||
if co.epk.is_empty() {
|
if co.epk.is_empty() {
|
||||||
|
skipped = true;
|
||||||
co.epk = vec![0; 32];
|
co.epk = vec![0; 32];
|
||||||
}
|
}
|
||||||
if co.ciphertext.is_empty() {
|
if co.ciphertext.is_empty() {
|
||||||
co.ciphertext = vec![0; 52];
|
co.ciphertext = vec![0; 52];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if skipped {
|
||||||
|
log::info!("Output skipped {}", b.outputs.len());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let block_output_count: usize = block.vtx.iter().map(|tx| tx.outputs.len()).sum();
|
let block_output_count: usize = block.vtx.iter().map(|tx| tx.outputs.len()).sum();
|
||||||
|
|
|
@ -109,6 +109,8 @@ pub struct BlockRange {
|
||||||
pub start: ::core::option::Option<BlockId>,
|
pub start: ::core::option::Option<BlockId>,
|
||||||
#[prost(message, optional, tag="2")]
|
#[prost(message, optional, tag="2")]
|
||||||
pub end: ::core::option::Option<BlockId>,
|
pub end: ::core::option::Option<BlockId>,
|
||||||
|
#[prost(uint64, tag="3")]
|
||||||
|
pub spam_filter_threshold: u64,
|
||||||
}
|
}
|
||||||
/// A TxFilter contains the information needed to identify a particular
|
/// A TxFilter contains the information needed to identify a particular
|
||||||
/// transaction: either a block and an index, or a direct transaction hash.
|
/// transaction: either a block and an index, or a direct transaction hash.
|
||||||
|
|
|
@ -11,7 +11,7 @@ use rocket::{response, Request, Response, State};
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::io::{BufReader, Read};
|
use std::io::{BufReader, Read};
|
||||||
use std::sync::atomic::AtomicBool;
|
use std::sync::Mutex;
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
use warp_api_ffi::api::payment::{Recipient, RecipientMemo};
|
use warp_api_ffi::api::payment::{Recipient, RecipientMemo};
|
||||||
use warp_api_ffi::api::payment_uri::PaymentURI;
|
use warp_api_ffi::api::payment_uri::PaymentURI;
|
||||||
|
@ -21,7 +21,7 @@ use warp_api_ffi::{
|
||||||
};
|
};
|
||||||
|
|
||||||
lazy_static! {
|
lazy_static! {
|
||||||
static ref SYNC_CANCELED: AtomicBool = AtomicBool::new(false);
|
static ref SYNC_CANCELED: Mutex<bool> = Mutex::new(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Error, Debug)]
|
#[derive(Error, Debug)]
|
||||||
|
|
|
@ -94,6 +94,7 @@ pub async fn sync_async(
|
||||||
start_height,
|
start_height,
|
||||||
end_height,
|
end_height,
|
||||||
prev_hash,
|
prev_hash,
|
||||||
|
max_cost,
|
||||||
decryptor_tx,
|
decryptor_tx,
|
||||||
cancel,
|
cancel,
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue