Skip to content

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

Draft
Exxenoz wants to merge 4 commits intonanocurrency:developfrom
Exxenoz:ledger_extend_linked_account
Draft

Ledger: Use representative for change blocks and epoch signer for epoch blocks in linked_account#4842
Exxenoz wants to merge 4 commits intonanocurrency:developfrom
Exxenoz:ledger_extend_linked_account

Conversation

@Exxenoz
Copy link
Copy Markdown
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 <clemahieu@gmail.com>
Co-authored-by: gr0vity <gr0vity.dev@gmail.com>
@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
Copy Markdown

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
@Exxenoz
Copy link
Copy Markdown
Contributor Author

Exxenoz commented Mar 24, 2025

It's about this commit: 6de112d

Can someone tell me if this makes sense? If so, I'll do a rebase and fix the web socket tests; otherwise the PR can be closed.

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