mirror of
https://github.com/mimblewimble/grin.git
synced 2025-01-21 03:21:08 +03:00
Add fee amount to wallet receive_transaction (mainly for testing purposes) (#150)
This commit is contained in:
parent
2e819c72aa
commit
2210e706f9
1 changed files with 8 additions and 2 deletions
|
@ -215,10 +215,16 @@ fn receive_transaction(
|
|||
let next_child = wallet_data.next_child(&ext_key.fingerprint);
|
||||
let out_key = ext_key.derive(&secp, next_child).map_err(|e| Error::Key(e))?;
|
||||
|
||||
// TODO - replace with real fee calculation
|
||||
// TODO - note we are not enforcing this in consensus anywhere yet
|
||||
let fee_amount = 1;
|
||||
let out_amount = amount - fee_amount;
|
||||
|
||||
let (tx_final, _) = build::transaction(vec![
|
||||
build::initial_tx(partial),
|
||||
build::with_excess(blinding),
|
||||
build::output(amount, out_key.key),
|
||||
build::output(out_amount, out_key.key),
|
||||
build::with_fee(fee_amount),
|
||||
])?;
|
||||
|
||||
// make sure the resulting transaction is valid (could have been lied to
|
||||
|
@ -229,7 +235,7 @@ fn receive_transaction(
|
|||
wallet_data.append_output(OutputData {
|
||||
fingerprint: out_key.fingerprint,
|
||||
n_child: out_key.n_child,
|
||||
value: amount,
|
||||
value: out_amount,
|
||||
status: OutputStatus::Unconfirmed,
|
||||
height: 0,
|
||||
lock_height: 0,
|
||||
|
|
Loading…
Reference in a new issue