Skip to content

Commit

Permalink
Added minimum burn_amount calculation to transaction version zfuture …
Browse files Browse the repository at this point in the history
…builder
  • Loading branch information
mariopil committed Oct 30, 2024
1 parent de38595 commit 4029650
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 3 additions & 2 deletions zebra-chain/src/transaction/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ impl Transaction {
outputs: impl IntoIterator<Item = (Amount<NonNegative>, transparent::Script)>,
extra_coinbase_data: Vec<u8>,
like_zcashd: bool,
miner_fee: Amount<NonNegative>,
burn_amount: Option<Amount<NonNegative>>,
) -> Transaction {
let mut extra_data = None;
Expand Down Expand Up @@ -117,8 +118,8 @@ impl Transaction {
sapling_shielded_data: None,
orchard_shielded_data: None,

// > The NSM burn_amount field [ZIP-233] must be set. It can be set to 0.
burn_amount: burn_amount.unwrap_or(Amount::zero()),
// > The NSM burn_amount field [ZIP-233] must be set at minimum to 60% of miner fees [ZIP-235].
burn_amount: burn_amount.unwrap_or_else(|| ((miner_fee * 6).unwrap() / 10).unwrap()),
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,7 @@ pub fn generate_coinbase_transaction(
outputs,
extra_coinbase_data,
like_zcashd,
miner_fee,
burn_amount,
)
.into()
Expand All @@ -388,6 +389,7 @@ pub fn generate_coinbase_transaction(
outputs,
extra_coinbase_data,
like_zcashd,
miner_fee,
burn_amount,
)
.into()
Expand Down

0 comments on commit 4029650

Please sign in to comment.