Skip to content

Commit 4029650

Browse files
committed
Added minimum burn_amount calculation to transaction version zfuture builder
1 parent de38595 commit 4029650

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

zebra-chain/src/transaction/builder.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ impl Transaction {
1818
outputs: impl IntoIterator<Item = (Amount<NonNegative>, transparent::Script)>,
1919
extra_coinbase_data: Vec<u8>,
2020
like_zcashd: bool,
21+
miner_fee: Amount<NonNegative>,
2122
burn_amount: Option<Amount<NonNegative>>,
2223
) -> Transaction {
2324
let mut extra_data = None;
@@ -117,8 +118,8 @@ impl Transaction {
117118
sapling_shielded_data: None,
118119
orchard_shielded_data: None,
119120

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

zebra-rpc/src/methods/get_block_template_rpcs/get_block_template.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,7 @@ pub fn generate_coinbase_transaction(
367367
outputs,
368368
extra_coinbase_data,
369369
like_zcashd,
370+
miner_fee,
370371
burn_amount,
371372
)
372373
.into()
@@ -388,6 +389,7 @@ pub fn generate_coinbase_transaction(
388389
outputs,
389390
extra_coinbase_data,
390391
like_zcashd,
392+
miner_fee,
391393
burn_amount,
392394
)
393395
.into()

0 commit comments

Comments
 (0)