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

Ledger: Use representative for change blocks and epoch signer for epoch blocks in linked_account #4842

Draft
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

Exxenoz
Copy link
Contributor

@Exxenoz Exxenoz commented Feb 9, 2025

  • For change blocks, ledger::linked_account now returns the block's representative
  • For epoch blocks, it returns the corresponding epoch signer

Issues resolved
This PR is an extension to PR #4841

This PR simplifies the detection of related accounts for block explorer applications. As a result, the following logic can be completely removed, reducing complexity:

switch (historyEntry.type) {
  case "change":
	relatedAccount = historyEntry.representative;
	break;
  case "open":
  case "receive":
	relatedAccount = historyEntry.account;
	break;
  case "send":
	relatedAccount = historyEntry.destination;
	break;
  case "state":
	switch (historyEntry.subtype) {
	  case "change":
		relatedAccount = historyEntry.representative;
		break;
	  case "epoch": // ToDo: Find epoch signer
		relatedAccount = historyEntry.account;
		break;
	  case "receive":
	  case "send":
		relatedAccount = historyEntry.account;
		break;
	}
	break;
}

Exxenoz and others added 4 commits February 9, 2025 17:30
- 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 ledger_extend_linked_account branch from b18a51e to 6de112d Compare February 9, 2025 17:03
@gr0vity-dev-bot
Copy link

gr0vity-dev-bot commented Feb 9, 2025

Test Results for Commit 6de112d

Pull Request 4842: Results
Overall Status:

Test Case Results

  • 5n4pr_conf_10k_bintree: PASS (Duration: 106s)
  • 5n4pr_conf_10k_change: PASS (Duration: 195s)
  • 5n4pr_conf_change_dependant: PASS (Duration: 120s)
  • 5n4pr_conf_change_independant: PASS (Duration: 126s)
  • 5n4pr_conf_send_dependant: PASS (Duration: 111s)
  • 5n4pr_conf_send_independant: PASS (Duration: 127s)
  • 5n4pr_rocks_10k_bintree: PASS (Duration: 114s)
  • 5n4pr_rocks_10k_change: PASS (Duration: 140s)

Last updated: 2025-02-09 17:54:06 UTC

@Exxenoz Exxenoz marked this pull request as draft February 9, 2025 20:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants