Skip to content

Commit b67b8cd

Browse files
authored
Test that mints without a cap are unmintable (ordinals#3495)
Test that if the `cap` field of an etching is unset, it is treated as being zero, and the rune is unmintable.Test that if the `cap` field of an etching is unset, it is treated as being zero, and the rune is unmintable.
1 parent 557301d commit b67b8cd

File tree

1 file changed

+85
-0
lines changed

1 file changed

+85
-0
lines changed

src/runes.rs

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4770,6 +4770,91 @@ mod tests {
47704770
);
47714771
}
47724772

4773+
#[test]
4774+
fn open_mints_without_a_cap_are_unmintable() {
4775+
let context = Context::builder().arg("--index-runes").build();
4776+
4777+
let (txid0, id) = context.etch(
4778+
Runestone {
4779+
etching: Some(Etching {
4780+
rune: Some(Rune(RUNE)),
4781+
terms: Some(Terms {
4782+
amount: Some(1000),
4783+
offset: (None, Some(2)),
4784+
..default()
4785+
}),
4786+
..default()
4787+
}),
4788+
..default()
4789+
},
4790+
1,
4791+
);
4792+
4793+
context.assert_runes(
4794+
[(
4795+
id,
4796+
RuneEntry {
4797+
block: id.block,
4798+
etching: txid0,
4799+
spaced_rune: SpacedRune {
4800+
rune: Rune(RUNE),
4801+
spacers: 0,
4802+
},
4803+
timestamp: id.block,
4804+
terms: Some(Terms {
4805+
amount: Some(1000),
4806+
offset: (None, Some(2)),
4807+
..default()
4808+
}),
4809+
..default()
4810+
},
4811+
)],
4812+
[],
4813+
);
4814+
4815+
context.core.broadcast_tx(TransactionTemplate {
4816+
inputs: &[(2, 0, 0, Witness::new())],
4817+
op_return: Some(
4818+
Runestone {
4819+
edicts: vec![Edict {
4820+
id,
4821+
amount: 1000,
4822+
output: 0,
4823+
}],
4824+
mint: Some(id),
4825+
..default()
4826+
}
4827+
.encipher(),
4828+
),
4829+
..default()
4830+
});
4831+
4832+
context.mine_blocks(1);
4833+
4834+
context.assert_runes(
4835+
[(
4836+
id,
4837+
RuneEntry {
4838+
block: id.block,
4839+
spaced_rune: SpacedRune {
4840+
rune: Rune(RUNE),
4841+
spacers: 0,
4842+
},
4843+
timestamp: id.block,
4844+
mints: 0,
4845+
etching: txid0,
4846+
terms: Some(Terms {
4847+
amount: Some(1000),
4848+
offset: (None, Some(2)),
4849+
..default()
4850+
}),
4851+
..default()
4852+
},
4853+
)],
4854+
[],
4855+
);
4856+
}
4857+
47734858
#[test]
47744859
fn open_mint_claims_can_use_split() {
47754860
let context = Context::builder().arg("--index-runes").build();

0 commit comments

Comments
 (0)