Skip to content

Commit 966bf74

Browse files
author
DogLooksGood
committed
Add solana fee cap
1 parent 1db7cd0 commit 966bf74

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

transport/src/solana.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ mod nft;
5757

5858
const METAPLEX_PROGRAM_ID: &str = "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s";
5959

60+
const FEE_CAP: u64 = 20000;
61+
6062
fn read_keypair(path: PathBuf) -> TransportResult<Keypair> {
6163
let keypair = solana_sdk::signature::read_keypair_file(path)
6264
.map_err(|e| TransportError::InvalidKeyfile(e.to_string()))?;
@@ -1512,8 +1514,11 @@ impl SolanaTransport {
15121514
fee += f.prioritization_fee;
15131515
}
15141516
info!("Estimate fee: {} in lamports", fee);
1515-
// XXX: We add a fixed amount to recommended fee
1516-
Ok(fee + 10000)
1517+
if fee > FEE_CAP {
1518+
info!("Use {} fee cap", FEE_CAP);
1519+
fee = FEE_CAP;
1520+
}
1521+
Ok(fee)
15171522
}
15181523

15191524
fn get_min_lamports(&self, account_len: usize) -> TransportResult<u64> {

0 commit comments

Comments
 (0)