Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

Commit 260dfa2

Browse files
authored
token-lending-cli: Sign before checking fee for message (#2761)
1 parent 2e03106 commit 260dfa2

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

token-lending/cli/src/main.rs

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -457,17 +457,17 @@ fn command_create_lending_market(
457457
);
458458

459459
let recent_blockhash = config.rpc_client.get_latest_blockhash()?;
460+
transaction.sign(
461+
&vec![config.fee_payer.as_ref(), &lending_market_keypair],
462+
recent_blockhash,
463+
);
460464
check_fee_payer_balance(
461465
config,
462466
lending_market_balance
463467
+ config
464468
.rpc_client
465469
.get_fee_for_message(transaction.message())?,
466470
)?;
467-
transaction.sign(
468-
&vec![config.fee_payer.as_ref(), &lending_market_keypair],
469-
recent_blockhash,
470-
);
471471
send_transaction(config, transaction)?;
472472
Ok(())
473473
}
@@ -644,19 +644,6 @@ fn command_add_reserve(
644644
);
645645

646646
let recent_blockhash = config.rpc_client.get_latest_blockhash()?;
647-
check_fee_payer_balance(
648-
config,
649-
total_balance
650-
+ config
651-
.rpc_client
652-
.get_fee_for_message(transaction_1.message())?
653-
+ config
654-
.rpc_client
655-
.get_fee_for_message(transaction_2.message())?
656-
+ config
657-
.rpc_client
658-
.get_fee_for_message(transaction_3.message())?,
659-
)?;
660647
transaction_1.sign(
661648
&vec![
662649
config.fee_payer.as_ref(),
@@ -684,6 +671,19 @@ fn command_add_reserve(
684671
],
685672
recent_blockhash,
686673
);
674+
check_fee_payer_balance(
675+
config,
676+
total_balance
677+
+ config
678+
.rpc_client
679+
.get_fee_for_message(transaction_1.message())?
680+
+ config
681+
.rpc_client
682+
.get_fee_for_message(transaction_2.message())?
683+
+ config
684+
.rpc_client
685+
.get_fee_for_message(transaction_3.message())?,
686+
)?;
687687
send_transaction(config, transaction_1)?;
688688
send_transaction(config, transaction_2)?;
689689
send_transaction(config, transaction_3)?;

0 commit comments

Comments
 (0)