Skip to content

Commit 1ba97e5

Browse files
committed
feat: remove bip30 field from coinstat index
1 parent 50264a0 commit 1ba97e5

5 files changed

Lines changed: 2 additions & 14 deletions

File tree

src/index/coinstatsindex.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -144,13 +144,6 @@ bool CoinStatsIndex::WriteBlock(const CBlock& block, const CBlockIndex* pindex)
144144
for (size_t i = 0; i < block.vtx.size(); ++i) {
145145
const auto& tx{block.vtx.at(i)};
146146

147-
// Skip duplicate txid coinbase transactions (BIP30).
148-
if (IsBIP30Unspendable(*pindex) && tx->IsCoinBase()) {
149-
m_total_unspendable_amount += block_subsidy;
150-
m_total_unspendables_bip30 += block_subsidy;
151-
continue;
152-
}
153-
154147
for (uint32_t j = 0; j < tx->vout.size(); ++j) {
155148
const CTxOut& out{tx->vout[j]};
156149
Coin coin{out, pindex->nHeight, tx->IsCoinBase()};

src/index/coinstatsindex.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ class CoinStatsIndex final : public BaseIndex
3232
CAmount m_total_new_outputs_ex_coinbase_amount{0};
3333
CAmount m_total_coinbase_amount{0};
3434
CAmount m_total_unspendables_genesis_block{0};
35+
//! There's no unspendable coinbase outputs in dash core. TODO: remove it with a version bump
3536
CAmount m_total_unspendables_bip30{0};
3637
CAmount m_total_unspendables_scripts{0};
3738
CAmount m_total_unspendables_unclaimed_rewards{0};

src/kernel/coinstats.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ struct CCoinsStats {
5858
CAmount total_coinbase_amount{0};
5959
//! The unspendable coinbase amount from the genesis block
6060
CAmount total_unspendables_genesis_block{0};
61-
//! The two unspendable coinbase outputs total amount caused by BIP30
61+
//! There's no unspendable coinbase outputs in dash core. TODO: remove it with a version bump
6262
CAmount total_unspendables_bip30{0};
6363
//! Total cumulative amount of outputs sent to unspendable scripts (OP_RETURN for example) up to and including this block
6464
CAmount total_unspendables_scripts{0};

src/rpc/blockchain.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1171,7 +1171,6 @@ static RPCHelpMan gettxoutsetinfo()
11711171
{RPCResult::Type::OBJ, "unspendables", "Detailed view of the unspendable categories",
11721172
{
11731173
{RPCResult::Type::STR_AMOUNT, "genesis_block", "The unspendable amount of the Genesis block subsidy"},
1174-
{RPCResult::Type::STR_AMOUNT, "bip30", "Transactions overridden by duplicates (no longer possible with BIP30)"},
11751174
{RPCResult::Type::STR_AMOUNT, "scripts", "Amounts sent to scripts that are unspendable (for example OP_RETURN outputs)"},
11761175
{RPCResult::Type::STR_AMOUNT, "unclaimed_rewards", "Fee rewards that miners did not claim in their coinbase transaction"},
11771176
}}
@@ -1275,7 +1274,6 @@ static RPCHelpMan gettxoutsetinfo()
12751274

12761275
UniValue unspendables(UniValue::VOBJ);
12771276
unspendables.pushKV("genesis_block", ValueFromAmount(stats.total_unspendables_genesis_block - prev_stats.total_unspendables_genesis_block));
1278-
unspendables.pushKV("bip30", ValueFromAmount(stats.total_unspendables_bip30 - prev_stats.total_unspendables_bip30));
12791277
unspendables.pushKV("scripts", ValueFromAmount(stats.total_unspendables_scripts - prev_stats.total_unspendables_scripts));
12801278
unspendables.pushKV("unclaimed_rewards", ValueFromAmount(stats.total_unspendables_unclaimed_rewards - prev_stats.total_unspendables_unclaimed_rewards));
12811279
block_info.pushKV("unspendables", unspendables);

test/functional/feature_coinstatsindex.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,6 @@ def _test_coin_stats_index(self):
135135
'coinbase': 0,
136136
'unspendables': {
137137
'genesis_block': 50,
138-
'bip30': 0,
139138
'scripts': 0,
140139
'unclaimed_rewards': 0
141140
}
@@ -152,7 +151,6 @@ def _test_coin_stats_index(self):
152151
'coinbase': Decimal('500.00025500'),
153152
'unspendables': {
154153
'genesis_block': 0,
155-
'bip30': 0,
156154
'scripts': 0,
157155
'unclaimed_rewards': 0,
158156
}
@@ -189,7 +187,6 @@ def _test_coin_stats_index(self):
189187
'coinbase': Decimal('500.00101000'),
190188
'unspendables': {
191189
'genesis_block': 0,
192-
'bip30': 0,
193190
'scripts': Decimal('20.99900000'),
194191
'unclaimed_rewards': 0,
195192
}
@@ -220,7 +217,6 @@ def _test_coin_stats_index(self):
220217
'coinbase': 40,
221218
'unspendables': {
222219
'genesis_block': 0,
223-
'bip30': 0,
224220
'scripts': 0,
225221
'unclaimed_rewards': 460
226222
}

0 commit comments

Comments
 (0)