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:
parent
58ef02f02b
commit
f342a50a76
|
@ -127,9 +127,13 @@ pub fn update_finalized_transaction(
|
||||||
) -> Result<Option<usize>, Error> {
|
) -> Result<Option<usize>, Error> {
|
||||||
if opt_transaction_status.is_none() {
|
if opt_transaction_status.is_none() {
|
||||||
if !recent_blockhashes.contains(blockhash) {
|
if !recent_blockhashes.contains(blockhash) {
|
||||||
eprintln!("Signature not found {} and blockhash expired", signature);
|
eprintln!(
|
||||||
eprintln!("Discarding transaction record");
|
"Signature not found {} and blockhash not found, likely expired",
|
||||||
db.rem(&signature.to_string())?;
|
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);
|
return Ok(None);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -245,8 +249,11 @@ mod tests {
|
||||||
None
|
None
|
||||||
);
|
);
|
||||||
|
|
||||||
// Ensure TransactionInfo has been purged.
|
// Ensure TransactionInfo has not been purged.
|
||||||
assert_eq!(db.get::<TransactionInfo>(&signature.to_string()), None);
|
assert_eq!(
|
||||||
|
db.get::<TransactionInfo>(&signature.to_string()).unwrap(),
|
||||||
|
transaction_info
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
Loading…
Reference in New Issue