Update fee api to use blockhash (#21054)

This commit is contained in:
Jack May
2021-10-29 13:52:59 -07:00
committed by GitHub
parent aea3c66fa8
commit bced07a099
16 changed files with 142 additions and 93 deletions

View File

@@ -3042,18 +3042,19 @@ mod tests {
let slot = slot + 1;
let bank2 = Arc::new(Bank::new_from_parent(&bank1, &collector, slot));
let blockhash = bank2.last_blockhash();
let tx = SanitizedTransaction::from_transaction_for_tests(system_transaction::transfer(
&key1,
&key2.pubkey(),
lamports_to_transfer,
bank2.last_blockhash(),
blockhash,
));
let fee = bank2.get_fee_for_message(tx.message());
let fee = bank2.get_fee_for_message(tx.message()).unwrap();
let tx = system_transaction::transfer(
&key1,
&key2.pubkey(),
lamports_to_transfer - fee,
bank2.last_blockhash(),
blockhash,
);
bank2.process_transaction(&tx).unwrap();
assert_eq!(