Don't discard transaction record when blockhash not found (#10058)

* Don't discard transaction records

Not enough certainty, because only half the blockhashes
are returned via the RPC call. Even if all 300, there's
still the possiblity other validators are behind, and
a superamajority will vote on on a block that includes
the transaction.

* fmt
This commit is contained in:
Greg Fitzgerald 2020-05-15 11:43:30 -06:00 committed by GitHub
parent 58ef02f02b
commit f342a50a76
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 5 deletions

View File

@ -127,9 +127,13 @@ pub fn update_finalized_transaction(
) -> Result<Option<usize>, Error> {
if opt_transaction_status.is_none() {
if !recent_blockhashes.contains(blockhash) {
eprintln!("Signature not found {} and blockhash expired", signature);
eprintln!("Discarding transaction record");
db.rem(&signature.to_string())?;
eprintln!(
"Signature not found {} and blockhash not found, likely expired",
signature
);
// Don't discard the transaction, because we are not certain the
// blockhash is expired. Instead, return None to signal that
// we don't need to wait for confirmations.
return Ok(None);
}
@ -245,8 +249,11 @@ mod tests {
None
);
// Ensure TransactionInfo has been purged.
assert_eq!(db.get::<TransactionInfo>(&signature.to_string()), None);
// Ensure TransactionInfo has not been purged.
assert_eq!(
db.get::<TransactionInfo>(&signature.to_string()).unwrap(),
transaction_info
);
}
#[test]