diff --git a/src/index/updater/rune_updater.rs b/src/index/updater/rune_updater.rs index 62808e41c1..651c73e87f 100644 --- a/src/index/updater/rune_updater.rs +++ b/src/index/updater/rune_updater.rs @@ -300,7 +300,15 @@ impl<'a, 'db, 'tx> RuneUpdater<'a, 'db, 'tx> { mint: mint.and_then(|mint| (!burn).then_some(mint)), rune, spacers, - supply: u128::max_value() - balance, + supply: if let Some(mint) = mint { + if mint.end == Some(self.height) { + 0 + } else { + mint.limit.unwrap_or(runes::MAX_LIMIT) + } + } else { + u128::max_value() + } - balance, symbol, timestamp: self.timestamp, } diff --git a/src/runes.rs b/src/runes.rs index be42b23833..3ee6a73400 100644 --- a/src/runes.rs +++ b/src/runes.rs @@ -3,11 +3,6 @@ use { super::*, }; -// todo: -// - runes::tests::open_etchings_with_term_zero_cannot_be_minted -// - runes::tests::runes_can_be_etched_and_claimed_in_the_same_transaction -// - runes::tests::transactions_cannot_claim_more_than_limit - pub use {edict::Edict, rune::Rune, rune_id::RuneId, runestone::Runestone}; pub(crate) use {etching::Etching, mint::Mint, pile::Pile, spaced_rune::SpacedRune}; diff --git a/tests/etch.rs b/tests/etch.rs index 89efbf72bc..c66cf121b5 100644 --- a/tests/etch.rs +++ b/tests/etch.rs @@ -174,17 +174,13 @@ fn runes_can_be_etched() { bitcoin_rpc_server.mine_blocks(1); - assert_eq!( + pretty_assert_eq!( runes(&bitcoin_rpc_server), vec![( Rune(RUNE), RuneInfo { burned: 0, - mint: Some(MintEntry { - deadline: None, - end: None, - limit: None, - }), + mint: None, divisibility: 1, etching: output.transaction, height: 2, diff --git a/tests/json_api.rs b/tests/json_api.rs index 7835025a5e..a0c0c4fd90 100644 --- a/tests/json_api.rs +++ b/tests/json_api.rs @@ -537,11 +537,7 @@ fn get_runes() { RuneJson { entry: RuneEntry { burned: 0, - mint: Some(MintEntry { - limit: None, - end: None, - deadline: None, - }), + mint: None, divisibility: 0, etching: a.transaction, mints: 0, @@ -577,11 +573,7 @@ fn get_runes() { }, RuneEntry { burned: 0, - mint: Some(MintEntry { - end: None, - limit: None, - deadline: None, - }), + mint: None, divisibility: 0, etching: a.transaction, mints: 0, @@ -600,11 +592,7 @@ fn get_runes() { }, RuneEntry { burned: 0, - mint: Some(MintEntry { - deadline: None, - end: None, - limit: None, - }), + mint: None, divisibility: 0, etching: b.transaction, mints: 0, @@ -623,11 +611,7 @@ fn get_runes() { }, RuneEntry { burned: 0, - mint: Some(MintEntry { - deadline: None, - end: None, - limit: None, - }), + mint: None, divisibility: 0, etching: c.transaction, mints: 0, diff --git a/tests/lib.rs b/tests/lib.rs index ea925037b1..0dd06460ec 100644 --- a/tests/lib.rs +++ b/tests/lib.rs @@ -20,7 +20,7 @@ use { inscriptions::InscriptionsJson, output::OutputJson, rune::RuneJson, runes::RunesJson, sat::SatJson, status::StatusJson, transaction::TransactionJson, }, - Edict, InscriptionId, MintEntry, Rune, RuneEntry, RuneId, Runestone, SatPoint, + Edict, InscriptionId, Rune, RuneEntry, RuneId, Runestone, SatPoint, }, pretty_assertions::assert_eq as pretty_assert_eq, regex::Regex, diff --git a/tests/runes.rs b/tests/runes.rs index 226053a1b8..341279ad70 100644 --- a/tests/runes.rs +++ b/tests/runes.rs @@ -54,11 +54,7 @@ fn one_rune() { Rune(RUNE), RuneInfo { burned: 0, - mint: Some(MintEntry { - deadline: None, - end: None, - limit: None, - }), + mint: None, divisibility: 0, etching: etch.transaction, height: 2, @@ -96,7 +92,7 @@ fn two_runes() { let a = etch(&bitcoin_rpc_server, &ord_rpc_server, Rune(RUNE)); let b = etch(&bitcoin_rpc_server, &ord_rpc_server, Rune(RUNE + 1)); - assert_eq!( + pretty_assert_eq!( CommandBuilder::new("--index-runes --regtest runes") .bitcoin_rpc_server(&bitcoin_rpc_server) .run_and_deserialize_output::(), @@ -106,11 +102,7 @@ fn two_runes() { Rune(RUNE), RuneInfo { burned: 0, - mint: Some(MintEntry { - deadline: None, - end: None, - limit: None, - }), + mint: None, divisibility: 0, etching: a.transaction, height: 2, @@ -132,11 +124,7 @@ fn two_runes() { Rune(RUNE + 1), RuneInfo { burned: 0, - mint: Some(MintEntry { - deadline: None, - end: None, - limit: None, - }), + mint: None, divisibility: 0, etching: b.transaction, height: 4,