Skip to content

Commit

Permalink
Revert "Fix certificate generation and validation"
Browse files Browse the repository at this point in the history
  • Loading branch information
Sjors committed Feb 5, 2024
1 parent e87a9d1 commit 027c635
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/common/sv2_noise.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ uint256 Sv2SignatureNoiseMessage::GetHash()
DataStream ss{};
ss << m_version
<< m_valid_from
<< m_valid_to
<< m_static_key;
<< m_valid_to;
// TODO: Stratum v2 spec requires signing the static key, but SRI currently
// implements this incorrectly.
// << m_static_key;

CSHA256 hasher;
hasher.Write(reinterpret_cast<unsigned char*>(&(*ss.begin())), ss.end() - ss.begin());
Expand Down
7 changes: 7 additions & 0 deletions src/test/sv2_noise_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ BOOST_AUTO_TEST_CASE(certificate_test)
uint32_t valid_from = now;
uint32_t valid_to = std::numeric_limits<unsigned int>::max();

// TODO: Stratum v2 spec requires signing the static key using the authority key,
// but SRI currently implements this incorrectly.
alice_authority_key = alice_static_key;

auto alice_certificate = Sv2SignatureNoiseMessage(version, valid_from, valid_to,
XOnlyPubKey(alice_static_key.GetPubKey()), alice_authority_key);

Expand Down Expand Up @@ -88,6 +92,9 @@ BOOST_AUTO_TEST_CASE(handshake_and_transport_test)
uint32_t valid_from = static_cast<uint32_t>(std::chrono::duration_cast<std::chrono::seconds>(epoch_now).count());
uint32_t valid_to = std::numeric_limits<unsigned int>::max();

// TODO: Stratum v2 spec requires signing the static key using the authority key,
// but SRI currently implements this incorrectly.
bob_authority_key = bob_static_key;
auto bob_certificate = Sv2SignatureNoiseMessage(version, valid_from, valid_to,
XOnlyPubKey(bob_static_key.GetPubKey()),
bob_authority_key);
Expand Down

0 comments on commit 027c635

Please sign in to comment.