Skip to content

Commit

Permalink
Add coinbase_output_max_sigops
Browse files Browse the repository at this point in the history
  • Loading branch information
Sjors committed Dec 16, 2024
1 parent 04d76c7 commit b1802e0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
7 changes: 7 additions & 0 deletions src/sv2/messages.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,17 +149,24 @@ struct Sv2CoinbaseOutputConstraintsMsg
*/
uint32_t m_coinbase_output_max_additional_size;

/**
* The maximum additional sigops which the pool will add in coinbase transaction outputs.
*/
uint16_t m_coinbase_output_max_sigops;

template <typename Stream>
void Serialize(Stream& s) const
{
s << m_coinbase_output_max_additional_size;
s << m_coinbase_output_max_sigops;
};


template <typename Stream>
void Unserialize(Stream& s)
{
s >> m_coinbase_output_max_additional_size;
s >> m_coinbase_output_max_sigops;
}
};

Expand Down
3 changes: 2 additions & 1 deletion src/test/sv2_template_provider_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,8 @@ BOOST_AUTO_TEST_CASE(client_tests)
BOOST_REQUIRE(tester.GetBlockTemplateCount() == 0);

std::vector<uint8_t> coinbase_output_constraint_bytes{
0x01, 0x00, 0x00, 0x00
0x01, 0x00, 0x00, 0x00, // coinbase_output_max_additional_size
0x00, 0x00 // coinbase_output_max_sigops
};
node::Sv2NetMsg msg{node::Sv2MsgType::COINBASE_OUTPUT_CONSTRAINTS, std::move(coinbase_output_constraint_bytes)};
tester.receiveMessage(msg);
Expand Down
2 changes: 1 addition & 1 deletion src/test/sv2_transport_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ BOOST_AUTO_TEST_CASE(sv2_transport_responder_test)
tester.CompareHash();

// Handshake complete, have the initiator send us a message:
Sv2CoinbaseOutputConstraintsMsg body{4000};
Sv2CoinbaseOutputConstraintsMsg body{4000, 400};
Sv2NetMsg msg{body};
BOOST_REQUIRE(msg.m_msg_type == Sv2MsgType::COINBASE_OUTPUT_CONSTRAINTS);

Expand Down

0 comments on commit b1802e0

Please sign in to comment.