Skip to content

Commit 9122791

Browse files
committed
Handle coinbase in get_tx_fee/s.
1 parent a734466 commit 9122791

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

  • include/bitcoin/database/impl/query

include/bitcoin/database/impl/query/fees.ipp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,13 @@ TEMPLATE
3636
uint64_t CLASS::get_tx_fee(const tx_link& link) const NOEXCEPT
3737
{
3838
const auto tx = get_transaction(link, false);
39-
if (is_coinbase(link))
40-
return {};
39+
if (!tx)
40+
return max_uint64;
4141

42-
return tx && populate_without_metadata(*tx) ? tx->fee() : max_uint64;
42+
if (tx->is_coinbase())
43+
return zero;
44+
45+
return populate_without_metadata(*tx) ? tx->fee() : max_uint64;
4346
}
4447

4548
TEMPLATE
@@ -54,7 +57,7 @@ TEMPLATE
5457
bool CLASS::get_tx_fees(fee_rate& out, const tx_link& link) const NOEXCEPT
5558
{
5659
const auto tx = get_transaction(link, false);
57-
if (!tx || !populate_without_metadata(*tx))
60+
if (!tx || tx->is_coinbase() || !populate_without_metadata(*tx))
5861
return false;
5962

6063
out.bytes = tx->virtual_size();

0 commit comments

Comments
 (0)