mirror of
https://github.com/jwinterm/grin-wallet.git
synced 2026-10-24 18:38:32 +02:00
Implement fee inclusive transactions (#657)
* Add amount_includes_fee option in TX building * Add --amount_includes_fee CLI option * Implement send 'max' amount Co-authored-by: cliik <cliik@example.com>
This commit is contained in:
@@ -508,6 +508,7 @@ where
|
||||
&mut *w,
|
||||
keychain_mask,
|
||||
args.amount,
|
||||
args.amount_includes_fee.unwrap_or(false),
|
||||
args.minimum_confirmations,
|
||||
args.max_outputs as usize,
|
||||
args.num_change_outputs as usize,
|
||||
@@ -543,6 +544,7 @@ where
|
||||
&parent_key_id,
|
||||
true,
|
||||
use_test_rng,
|
||||
args.amount_includes_fee.unwrap_or(false),
|
||||
)?
|
||||
};
|
||||
|
||||
@@ -696,6 +698,7 @@ where
|
||||
&parent_key_id,
|
||||
false,
|
||||
use_test_rng,
|
||||
false,
|
||||
)?;
|
||||
|
||||
let keychain = w.keychain(keychain_mask)?;
|
||||
@@ -823,6 +826,7 @@ where
|
||||
parent_key_id.clone(),
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
)?;
|
||||
|
||||
// Add inputs and outputs to original context
|
||||
|
||||
@@ -40,6 +40,8 @@ pub struct InitTxArgs {
|
||||
#[serde(with = "secp_ser::string_or_u64")]
|
||||
/// The amount to send, in nanogrins. (`1 G = 1_000_000_000nG`)
|
||||
pub amount: u64,
|
||||
/// Does the amount include the fee, or will fees be spent in addition to the amount?
|
||||
pub amount_includes_fee: Option<bool>,
|
||||
#[serde(with = "secp_ser::string_or_u64")]
|
||||
/// The minimum number of confirmations an output
|
||||
/// should have in order to be included in the transaction.
|
||||
@@ -105,6 +107,7 @@ impl Default for InitTxArgs {
|
||||
InitTxArgs {
|
||||
src_acct_name: None,
|
||||
amount: 0,
|
||||
amount_includes_fee: None,
|
||||
minimum_confirmations: 10,
|
||||
max_outputs: 500,
|
||||
num_change_outputs: 1,
|
||||
|
||||
Reference in New Issue
Block a user