Skip to content

Commit

Permalink
Test underpay subsidy
Browse files Browse the repository at this point in the history
  • Loading branch information
terror committed Feb 6, 2022
1 parent 04d102f commit dd00332
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
2 changes: 1 addition & 1 deletion tests/find.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ fn regression_empty_block_crash() -> Result {
Test::new()?
.command("find --blocksdir blocks 0 --slot --as-of-height 1")
.block()
.block_with_coinbase(false, true)
.block_with_coinbase(false, true, 50 * COIN_VALUE)
.expected_stdout("0.0.0.0\n")
.run()
}
Expand Down
6 changes: 3 additions & 3 deletions tests/integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,10 @@ impl Test {
}

fn block(self) -> Self {
self.block_with_coinbase(true, true)
self.block_with_coinbase(true, true, 50 * COIN_VALUE)
}

fn block_with_coinbase(mut self, coinbase: bool, include_height: bool) -> Self {
fn block_with_coinbase(mut self, coinbase: bool, include_height: bool, subsidy: u64) -> Self {
self.blocks.push(Block {
header: BlockHeader {
version: 0,
Expand Down Expand Up @@ -173,7 +173,7 @@ impl Test {
witness: vec![],
}],
output: vec![TxOut {
value: 50 * COIN_VALUE,
value: subsidy,
script_pubkey: script::Builder::new().into_script(),
}],
}]
Expand Down
15 changes: 13 additions & 2 deletions tests/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,21 @@ fn duplicate_transaction_range() -> Result {
.command(
"list --blocksdir blocks d63a320a4b404d7933ca788e8f185f10e31e03bf6ab9fa4595bfedc2fcc5a4a8:0",
)
.block_with_coinbase(true, false)
.block_with_coinbase(true, false)
.block_with_coinbase(true, false, 50 * COIN_VALUE)
.block_with_coinbase(true, false, 50 * COIN_VALUE)
.block()
.transaction(&[(0, 0, 0)], 1)
.expected_stdout("[5000000000,10000000000)\n")
.run()
}

#[test]
fn underpay_subsidy() -> Result {
Test::new()?
.command(
"list --blocksdir blocks 12d57183977a1df616bafbb7dafbb4249e59d8f796ba556ad6bb75f0fa9fe0ea:0",
)
.block_with_coinbase(true, true, 5000000000 - 1)
.expected_stdout("[0,4999999999)\n")
.run()
}

0 comments on commit dd00332

Please sign in to comment.