Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

possible fix #977

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 15 additions & 8 deletions apps/src/lib/client/signing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,13 +188,19 @@ pub async fn sign_wrapper(
) -> TxBroadcastData {
let client = HttpClient::new(args.ledger_address.clone()).unwrap();

let fee_amount = if cfg!(feature = "mainnet") {
Amount::from(100)
} else {
let wrapper_tx_fees_key = parameter_storage::get_wrapper_tx_fees_key();
rpc::query_storage_value::<token::Amount>(&client, &wrapper_tx_fees_key)
.await
.unwrap_or_default()
let fee_amount =
if requires_pow {
Amount::from(0)
}
else {
if cfg!(feature = "mainnet") {
Amount::from(100)
} else {
let wrapper_tx_fees_key = parameter_storage::get_wrapper_tx_fees_key();
rpc::query_storage_value::<token::Amount>(&client, &wrapper_tx_fees_key)
.await
.unwrap_or_default()
}
};
let fee_token = ctx.get(&args.fee_token);
let source = Address::from(&keypair.ref_to());
Expand All @@ -203,6 +209,7 @@ pub async fn sign_wrapper(
rpc::query_storage_value::<token::Amount>(&client, &balance_key)
.await
.unwrap_or_default();

if balance < fee_amount {
eprintln!(
"The wrapper transaction source doesn't have enough balance to \
Expand All @@ -219,7 +226,7 @@ pub async fn sign_wrapper(
// If the address derived from the keypair doesn't have enough balance
// to pay for the fee, allow to find a PoW solution instead.
if requires_pow || balance < fee_amount {
println!("The transaction requires to a PoW challenge.");
println!("This transaction requires the completion of a PoW challenge.");
// Obtain a PoW challenge for faucet withdrawal
let challenge = rpc::get_testnet_pow_challenge(
source,
Expand Down