Skip to content

Conversation

@qlrd
Copy link
Collaborator

@qlrd qlrd commented Sep 16, 2025

What is the purpose of this pull request?

  • Bug fix
  • Documentation update
  • New feature
  • Test
  • Other:

Which crates are being modified?

  • floresta-chain
  • floresta-cli
  • floresta-common
  • floresta-compact-filters
  • floresta-electrum
  • floresta-watch-only
  • floresta-wire
  • floresta
  • florestad
  • Other:

Description and Notes

This PR is a partial fix of #622, in the sense to define enum variants compliant to the "connection_type" field returned by the bitcoin-core's getpeerinfo rpc.

How to verify the changes you have done?

It add to the ConnectionKind::Regular, ConnectionKind::Extra and ConnectionKind::Manual variants 2 new subvariants OutboundKind::OutboundFullRelay and OutboundKind::BlockRelayOnly, as well add a AddrFetch (the Inbound type is excluded since this one do not make sense in Floresta).

@Davidson-Souza Davidson-Souza added enhancement New feature or request RPC Changes something with our JSON-RPC interface labels Sep 16, 2025
@Davidson-Souza
Copy link
Member

I think you should remove the Fixes 623 part, as this is a partial fix. This PR shouldn't close the issue

@qlrd qlrd force-pushed the feat/improve-connection-kind-enums branch 2 times, most recently from daffd22 to db806d8 Compare September 17, 2025 00:52
@qlrd qlrd force-pushed the feat/improve-connection-kind-enums branch 2 times, most recently from 091f3b6 to 60cc332 Compare September 19, 2025 00:00
@qlrd qlrd requested a review from Davidson-Souza September 19, 2025 00:38
@qlrd qlrd force-pushed the feat/improve-connection-kind-enums branch 2 times, most recently from 1971cd9 to eeae205 Compare September 24, 2025 15:50
@qlrd qlrd requested a review from Davidson-Souza September 24, 2025 18:19
@qlrd qlrd force-pushed the feat/improve-connection-kind-enums branch from eeae205 to b352d21 Compare September 26, 2025 14:08
@qlrd qlrd force-pushed the feat/improve-connection-kind-enums branch 3 times, most recently from 341dd71 to 611b980 Compare October 1, 2025 12:50
@qlrd qlrd requested a review from Davidson-Souza October 1, 2025 19:03
@qlrd qlrd force-pushed the feat/improve-connection-kind-enums branch from 611b980 to 7373a2d Compare October 10, 2025 00:34
qlrd added 2 commits November 27, 2025 16:33
This commit add to the `ConnectionKind::Regular`,
`ConnectionKind::Extra` and `ConnectionKind::Manual` variants 2 new
subvariants `OutboundKind::OutboundFullRelay` and
`OutboundKind::BlockRelayOnly`, as well add a `AddrFetch` to comply with
Bitcoin-Core on the "connection_type" field of `getpeerinfo` rpc (we
exclude here a `Inbound` type, this one do not make sense in Floresta).

chore: remove `std::fmt::write` from
`floresta-wire/src/p2p_wire/error.rs`
…ion type.

This commit checks if the `kind` connection from floresta's
`getpeerinfo` rpc is compliant with the `connection_type` from
bitcoind's `getpeerinfo` rpc. Also fix some spell checks in old
unrelated files.
@qlrd qlrd force-pushed the feat/improve-connection-kind-enums branch from 7373a2d to 8099e15 Compare November 27, 2025 19:33
def block_header(self, block_hash: str):
"""
Return a block header, given its hash.
Return the hash of a block, given it's hash.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This description seems a bit confusing. If the function receives a block hash and simply returns the same hash, the purpose is not very clear.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It not returns the same hash, it returns the header given its hash. Maybe without , and with the word blockheader?

Suggested change
Return the hash of a block, given it's hash.
Return a blockheader given its hash.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this looks better

Suggested change
Return the hash of a block, given it's hash.
Return the block header for the given block hash.

@JoseSK999
Copy link
Member

Needs rebase

///
/// We automatically attempt to open [NodeContext::MAX_FULL_RELAY_PEERS]
/// using addresses from our [AddressMan].
OutboundFullRelay(ServiceFlags),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: can you move this one to be below Feeler (and above BlockRelayOnly)

@luisschwab
Copy link
Member

@qlrd are you still working on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request RPC Changes something with our JSON-RPC interface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants