Skip to content

Commit eca8684

Browse files
authored
Merge pull request #527 from evoskuil/master
Move fees to set_block_valid().
2 parents d89f5b9 + 8468081 commit eca8684

File tree

3 files changed

+10
-11
lines changed

3 files changed

+10
-11
lines changed

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ code CLASS::get_tx_state(uint64_t& fee, size_t& sigops, const tx_link& link,
260260
}
261261

262262
TEMPLATE
263-
bool CLASS::set_block_valid(const header_link& link) NOEXCEPT
263+
bool CLASS::set_block_valid(const header_link& link, uint64_t fees) NOEXCEPT
264264
{
265265
// ========================================================================
266266
const auto scope = store_.get_transactor();
@@ -270,14 +270,13 @@ bool CLASS::set_block_valid(const header_link& link) NOEXCEPT
270270
{
271271
{},
272272
schema::block_state::valid,
273-
0 // fees
273+
fees
274274
});
275275
// ========================================================================
276276
}
277277

278278
TEMPLATE
279-
bool CLASS::set_block_confirmable(const header_link& link,
280-
uint64_t fees) NOEXCEPT
279+
bool CLASS::set_block_confirmable(const header_link& link) NOEXCEPT
281280
{
282281
// ========================================================================
283282
const auto scope = store_.get_transactor();
@@ -287,7 +286,7 @@ bool CLASS::set_block_confirmable(const header_link& link,
287286
{
288287
{},
289288
schema::block_state::confirmable,
290-
fees
289+
0 // fees
291290
});
292291
// ========================================================================
293292
}

include/bitcoin/database/query.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -473,9 +473,9 @@ class query
473473
bool get_timestamp(uint32_t& timestamp,
474474
const header_link& link) const NOEXCEPT;
475475

476-
bool set_block_valid(const header_link& link) NOEXCEPT;
476+
bool set_block_valid(const header_link& link, uint64_t fees) NOEXCEPT;
477477
bool set_block_unconfirmable(const header_link& link) NOEXCEPT;
478-
bool set_block_confirmable(const header_link& link, uint64_t fees) NOEXCEPT;
478+
bool set_block_confirmable(const header_link& link) NOEXCEPT;
479479

480480
// set_txs_connected is FOR PERFORMANCE EVALUATION ONLY.
481481
bool set_txs_connected(const header_link& link) NOEXCEPT;

test/query/validate.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -215,11 +215,11 @@ BOOST_AUTO_TEST_CASE(query_validate__get_block_state__confirmable__block_confirm
215215
BOOST_REQUIRE_EQUAL(query.get_block_state(fees, 0), error::unvalidated);
216216
BOOST_REQUIRE_EQUAL(fees, 0u);
217217

218-
BOOST_REQUIRE(query.set_block_confirmable(1, 42));
218+
BOOST_REQUIRE(query.set_block_confirmable(1));
219219
BOOST_REQUIRE_EQUAL(query.get_header_state(1), error::block_confirmable);
220220
BOOST_REQUIRE_EQUAL(query.get_block_state(1), error::block_confirmable);
221221
BOOST_REQUIRE_EQUAL(query.get_block_state(fees, 1), error::block_confirmable);
222-
BOOST_REQUIRE_EQUAL(fees, 42u);
222+
BOOST_REQUIRE_EQUAL(fees, 0u);
223223
}
224224

225225
BOOST_AUTO_TEST_CASE(query_validate__get_block_state__valid__block_valid)
@@ -233,11 +233,11 @@ BOOST_AUTO_TEST_CASE(query_validate__get_block_state__valid__block_valid)
233233
BOOST_REQUIRE(query.set(test::block1, context{}, false, false));
234234

235235
uint64_t fees{};
236-
BOOST_REQUIRE(query.set_block_valid(1));
236+
BOOST_REQUIRE(query.set_block_valid(1, 42));
237237
BOOST_REQUIRE_EQUAL(query.get_header_state(1), error::block_valid);
238238
BOOST_REQUIRE_EQUAL(query.get_block_state(1), error::block_valid);
239239
BOOST_REQUIRE_EQUAL(query.get_block_state(fees, 1), error::block_valid);
240-
BOOST_REQUIRE_EQUAL(fees, 0u);
240+
BOOST_REQUIRE_EQUAL(fees, 42u);
241241
}
242242

243243
BOOST_AUTO_TEST_CASE(query_validate__get_block_state__unconfirmable__block_unconfirmable)

0 commit comments

Comments
 (0)