Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Websocket: Add linked_account to block content of confirmation topic #4833

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

Exxenoz
Copy link
Contributor

@Exxenoz Exxenoz commented Jan 24, 2025

This PR introduces support for including a linked_account field in the block content of the websocket confirmation topic. Specifically:

  • The linked_account field is now included for all blocks when the include_linked_account option is enabled.
  • For change and epoch blocks, linked_account is set to "0", ensuring consistency with the source field in the blocks_info RPC response.

Issues resolved
This PR addresses the following issues:

@Exxenoz
Copy link
Contributor Author

Exxenoz commented Jan 24, 2025

Would it make sense to set linked_account for change blocks to the representative account and for epoch blocks to the epoch link/signer? This could help simplify some issues in block explorer applications, such as:

let relatedAccount = response.message.block.linked_account ?? response.message.block.account;
switch (response.message.block.subtype) {
  case "change":
	relatedAccount = response.message.block.representative;
	break;
  case "epoch": // ToDo: Find epoch link
	relatedAccount = response.message.block.account;
	break;
//--- solved by linked_account
  /*case "receive":
	// @TODO https://github.com/nanocurrency/nano-node/issues/3523 
	relatedAccount = response.message.block.account;
	break;
  case "send":
	relatedAccount = response.message.block.link_as_account;
	break;*/
}

- Add proper `linked_account` to the block content for send, receive, and open blocks when the `include_linked_account` option is enabled.
- For change and epoch blocks, `linked_account` is set to "0", maintaining consistency with the `source` field in the blocks_info RPC response.

Co-authored-by: clemahieu <[email protected]>
Co-authored-by: gr0vity <[email protected]>
@Exxenoz Exxenoz force-pushed the websocket_linked_account branch from ea467ba to 53fa929 Compare January 24, 2025 23:58
@gr0vity-dev-bot
Copy link

gr0vity-dev-bot commented Jan 25, 2025

Test Results for Commit 53fa929

Pull Request 4833: Results
Overall Status:

Test Case Results

  • 5n4pr_conf_10k_bintree: PASS (Duration: 114s)
  • 5n4pr_conf_10k_change: PASS (Duration: 143s)
  • 5n4pr_conf_change_dependant: PASS (Duration: 128s)
  • 5n4pr_conf_change_independant: PASS (Duration: 137s)
  • 5n4pr_conf_send_dependant: PASS (Duration: 113s)
  • 5n4pr_conf_send_independant: PASS (Duration: 126s)
  • 5n4pr_rocks_10k_bintree: PASS (Duration: 111s)
  • 5n4pr_rocks_10k_change: PASS (Duration: 143s)

Last updated: 2025-01-25 02:15:11 UTC

@qwahzi qwahzi added this to the V28 milestone Jan 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Progress / V28.0
Development

Successfully merging this pull request may close these issues.

4 participants