Skip to content

Commit ac9eb88

Browse files
authored
Merge pull request #1099 from evoskuil/master
Adapt to store p2p message changes, pass prune to block writer.
2 parents 880bddb + 302fbcb commit ac9eb88

7 files changed

Lines changed: 16 additions & 5 deletions

File tree

include/bitcoin/node/messages/block.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ struct BCN_API block
3030
{
3131
typedef std::shared_ptr<const block> cptr;
3232

33-
static const network::messages::peer::identifier id;
3433
static const std::string command;
3534
static const uint32_t version_minimum;
3635
static const uint32_t version_maximum;

include/bitcoin/node/messages/transaction.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ struct BCN_API transaction
3131
{
3232
typedef std::shared_ptr<const transaction> cptr;
3333

34-
static const network::messages::peer::identifier id;
3534
static const std::string command;
3635
static const uint32_t version_minimum;
3736
static const uint32_t version_maximum;

include/bitcoin/node/protocols/protocol_peer.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,12 @@ class BCN_API protocol_peer
9191
/// Determine if outgoing block or tx was previously announced by peer.
9292
virtual bool was_announced(const system::hash_digest&) const NOEXCEPT;
9393

94+
/// Currency.
95+
/// -----------------------------------------------------------------------
96+
97+
/// Set chain currency, which is not latched (channel buffer policy).
98+
virtual void set_current(bool value) NOEXCEPT;
99+
94100
/// Events notification.
95101
/// -----------------------------------------------------------------------
96102

src/messages/block.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ using namespace system;
2828
using namespace network::messages::peer;
2929

3030
const std::string block::command = "block";
31-
const identifier block::id = identifier::block;
3231
const uint32_t block::version_minimum = level::minimum_protocol;
3332
const uint32_t block::version_maximum = level::maximum_protocol;
3433

src/messages/transaction.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ using namespace system;
2828
using namespace network::messages::peer;
2929

3030
const std::string transaction::command = "tx";
31-
const identifier transaction::id = identifier::transaction;
3231
const uint32_t transaction::version_minimum = level::minimum_protocol;
3332
const uint32_t transaction::version_maximum = level::maximum_protocol;
3433

src/protocols/protocol_block_in_31800.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,10 @@ bool protocol_block_in_31800::handle_receive_block(const code& ec,
334334
// Commit block.txs.
335335
// ........................................................................
336336

337-
if (const auto code = query.set_code(block, link, checked, bypass, height))
337+
// Pruned nodes do not store input script or witness under bypass.
338+
const auto prune = bypass && node_pruned_;
339+
if (const auto code = query.set_code(block, link, checked, bypass, height,
340+
prune))
338341
{
339342
LOGF("Failure storing block [" << encode_hash(hash) << ":" << height
340343
<< "] from [" << opposite() << "] " << code.message());
@@ -353,6 +356,7 @@ bool protocol_block_in_31800::handle_receive_block(const code& ec,
353356
fire(events::block_archived, height);
354357

355358
count(block.serialized_size(true));
359+
set_current(is_current_chain(true));
356360
map_->erase(it);
357361
if (is_idle())
358362
{

src/protocols/protocol_peer.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,11 @@ void protocol_peer::set_announced(const system::hash_digest& hash) NOEXCEPT
8080
channel_->set_announced(hash);
8181
}
8282

83+
void protocol_peer::set_current(bool value) NOEXCEPT
84+
{
85+
channel_->set_current(value);
86+
}
87+
8388
bool protocol_peer::was_announced(const system::hash_digest& hash) const NOEXCEPT
8489
{
8590
return channel_->was_announced(hash);

0 commit comments

Comments
 (0)