Fixed DuplicateSigs (#3727)
* Fixed DuplicateSigs by not recording errors in signature cache of bank
This commit is contained in:
@ -402,19 +402,17 @@ impl Bank {
|
||||
);
|
||||
}
|
||||
}
|
||||
Err(TransactionError::BlockhashNotFound) => (),
|
||||
Err(TransactionError::DuplicateSignature) => (),
|
||||
Err(TransactionError::AccountNotFound) => (),
|
||||
Err(e) => {
|
||||
Err(TransactionError::InstructionError(b, e)) => {
|
||||
if !tx.signatures.is_empty() {
|
||||
status_cache.insert(
|
||||
&tx.message().recent_blockhash,
|
||||
&tx.signatures[0],
|
||||
self.slot(),
|
||||
Err(e.clone()),
|
||||
Err(TransactionError::InstructionError(*b, e.clone())),
|
||||
);
|
||||
}
|
||||
}
|
||||
Err(_) => (),
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1099,11 +1097,9 @@ mod tests {
|
||||
assert_eq!(bank.get_balance(&key1), 1);
|
||||
assert_eq!(bank.get_balance(&key2), 0);
|
||||
assert_eq!(bank.get_signature_status(&t1.signatures[0]), Some(Ok(())));
|
||||
// TODO: Transactions that fail to pay a fee could be dropped silently
|
||||
assert_eq!(
|
||||
bank.get_signature_status(&t2.signatures[0]),
|
||||
Some(Err(TransactionError::AccountInUse))
|
||||
);
|
||||
// TODO: Transactions that fail to pay a fee could be dropped silently.
|
||||
// Non-instruction errors don't get logged in the signature cache
|
||||
assert_eq!(bank.get_signature_status(&t2.signatures[0]), None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
Reference in New Issue
Block a user