This commit is contained in:
Greg Fitzgerald 2018-06-29 10:30:09 -06:00 committed by Grimes
parent 90dd794ae5
commit 517d08c637
3 changed files with 7 additions and 7 deletions

View File

@ -434,16 +434,16 @@ impl Bank {
self.transaction_count.load(Ordering::Relaxed)
}
pub fn check_signature(&self, signature: &Signature) -> bool {
pub fn has_signature(&self, signature: &Signature) -> bool {
let last_ids_sigs = self.last_ids_sigs
.read()
.expect("'last_ids_sigs' read lock");
for (_hash, signatures) in last_ids_sigs.iter() {
if let Some(_sig) = signatures.get(signature) {
if signatures.contains(signature) {
return true;
}
}
return false;
false
}
}
@ -634,13 +634,13 @@ mod tests {
}
#[test]
fn test_check_signature() {
fn test_has_signature() {
let mint = Mint::new(1);
let bank = Bank::new(&mint);
let sig = Signature::default();
bank.reserve_signature_with_last_id(&sig, &mint.last_id())
.expect("reserve signature");
assert!(bank.check_signature(&sig));
assert!(bank.has_signature(&sig));
}
#[test]

View File

@ -69,7 +69,7 @@ fn main() -> io::Result<()> {
let id = if matches.opt_present("m") {
read_mint(matches.opt_str("m").unwrap())
} else {
println!("No mint found!");
eprintln!("No mint found!");
exit(1);
};

View File

@ -41,7 +41,7 @@ impl RequestProcessor {
Some(rsp)
}
Request::GetSignature { signature } => {
let signature_status = self.bank.check_signature(&signature);
let signature_status = self.bank.has_signature(&signature);
let rsp = (Response::SignatureStatus { signature_status }, rsp_addr);
info!("Response::Signature {:?}", rsp);
Some(rsp)