Skip to content

Dynamic node list - #474

Merged
AnthonyLaw merged 7 commits into
NemProject:devfrom
curupo:feat/dynamic-node-list
Aug 4, 2026
Merged

Dynamic node list#474
AnthonyLaw merged 7 commits into
NemProject:devfrom
curupo:feat/dynamic-node-list

Conversation

@curupo

@curupo curupo commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@AnthonyLaw

AnthonyLaw commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Thanks for the update 🙏🏼 .
Fetching the node list from NodeWatch and caching the result looks good.

To make the implementation easier for the team to maintain in the future, I suggest moving this logic into the existing services:

  • Implement a loadNetworkNodes(network) method in nodes.service.js. This service should remain the single place responsible for loading, validating, caching, and providing node lists.

  • Call and await loadNetworkNodes(Wallet.network) inside the connect() method in dataBridge.service.js, since this is where the wallet begins selecting a node and establishing its connection.

  • If the NodeWatch request fails or times out, use the cached node list and then fall back to the bundled static nodes.

Keeping the logic inside the existing service structure should make the behavior clearer and easier to test and maintain. This is the suggested direction rather than a required implementation. Please feel free to propose another approach that keeps node-loading responsibility within nodes.service.js.

Comment thread nanowallet/src/vendors/dynamic-nodes.js Outdated
Comment thread nanowallet/src/vendors/dynamic-nodes.js Outdated
Comment thread nanowallet/src/start.html Outdated
curupo pushed a commit to curupo/miscellaneous that referenced this pull request Jul 30, 2026
curupo pushed a commit to curupo/miscellaneous that referenced this pull request Jul 30, 2026
curupo pushed a commit to curupo/miscellaneous that referenced this pull request Jul 30, 2026
curupo pushed a commit to curupo/miscellaneous that referenced this pull request Jul 30, 2026
@curupo
curupo force-pushed the feat/dynamic-node-list branch from e409edf to 5a2776e Compare July 30, 2026 01:37
@curupo

curupo commented Jul 30, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the review.
I've addressed the points you raised.
What do you think?

Comment thread nanowallet/src/app/services/nodes.service.js Outdated
Comment thread nanowallet/src/app/services/nodes.service.js Outdated
Comment thread nanowallet/src/app/services/nodes.service.js Outdated
Comment thread nanowallet/src/app/services/dataBridge.service.js Outdated
Comment thread nanowallet/src/app/services/nodes.service.js Outdated
Comment thread nanowallet/src/app/services/nodes.service.js Outdated
@AnthonyLaw

Copy link
Copy Markdown
Contributor

Thanks for the review. I've addressed the points you raised. What do you think?

Thank you for the update 👍🏼 Great work!

One more thing to consider: reconnect() calls this._Nodes.update(), but update() still selects from the bundled nem.model.nodes.* list. Could it select from this._Wallet.nodes instead, so automatic reconnection uses the NodeWatch or cached list while retaining the bundled nodes as a fallback? What do you think?

curupo pushed a commit to curupo/miscellaneous that referenced this pull request Jul 31, 2026
@curupo

curupo commented Jul 31, 2026

Copy link
Copy Markdown
Contributor Author

Thank you for the review.
The matter has been resolved🙏

@AnthonyLaw AnthonyLaw left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Good work!
I added some feeback, feel free take a look 🙏🏼

Comment thread nanowallet/src/app/services/nodes.service.js Outdated
Comment thread nanowallet/src/app/services/nodes.service.js Outdated
Comment thread nanowallet/src/app/services/nodes.service.js Outdated
Comment thread nanowallet/src/app/services/nodes.service.js Outdated
Comment thread nanowallet/src/app/services/nodes.service.js Outdated
Comment thread nanowallet/tests/specs/nodes.service.spec.js Outdated
Comment thread nanowallet/tests/specs/nodes.service.spec.js
curupo pushed a commit to curupo/miscellaneous that referenced this pull request Aug 3, 2026
@curupo

curupo commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the review.
It's gotten better!

curupo pushed a commit to curupo/miscellaneous that referenced this pull request Aug 3, 2026
@AnthonyLaw

Copy link
Copy Markdown
Contributor

Thanks for the review. It's gotten better!

Great job!
It look good now 👍🏼

@cryptoBeliever

cryptoBeliever commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Hi @curupo. Thank you for your changes. Great job! 👍

What I've found:

1. Node list is not visible on first login

Steps to reproduce:

  1. Log in.
  2. Open the node modal from the header. The <select> shows only the bundled static list, even though the NodeWatch fetch has already completed by then.
  3. Close the modal.
  4. Open it again. The full NodeWatch list is now there.
screen_record.mp4

@AnthonyLaw please verify the analysis below.

Root cause (AI): apply() in nodes.service.js:351 assigns this._Wallet.nodes = nodes from inside the .then() of a native Promise returned by fetchJsonWithTimeout(). Native promises are not integrated with Angular, so — unlike $http or $q — no $digest is triggered. The ngOptions
watcher on node.html:35 never fires and the <select> keeps rendering whatever the last digest produced.

Suggested fix (AI — please verify): wrap the assignment in $timeout, which is already injected into the service (nodes.service.js:147). It covers both the cached and the fetched branch, and matches the convention used elsewhere in the codebase, where every assignment made from an async callback is
wrapped the same way:

let apply = (nodes) => {
    if (!isUsableNodeList(nodes)) return null;
    // Assign inside a digest, the fetch above resolves outside of one
    this._$timeout(() => {
        this._Wallet.nodes = nodes;
    });
    return nodes;
};

2. Default node is picked from the hardcoded list (optional)

In the video the wallet connects to hugealice.nem.ninja. This isn't a major issue, since the user can switch to a different node from the list. If any changes are made in this area, it's important that the selected node is overwritten only if the user hasn't already chosen one themselves.

3. Hardcoded node list needs updating (separate PR)

@AnthonyLaw, we should also consider refreshing the hardcoded node list in a separate PR - most of those nodes are no longer active.

curupo pushed a commit to curupo/miscellaneous that referenced this pull request Aug 3, 2026
@masaakisaitoh

Copy link
Copy Markdown

@cryptoBeliever, thank you for the review.

  1. It was a bug. I’ve verified the fix and pushed the changes.
  2. I’ve confirmed that the currently selected node is preserved with the current implementation.
  3. I’ll leave this to @AnthonyLaw.

@cryptoBeliever

Copy link
Copy Markdown
Contributor

Thank you, great work 👍

@AnthonyLaw
AnthonyLaw force-pushed the feat/dynamic-node-list branch from b7aefa8 to cb684f0 Compare August 4, 2026 08:33

@AnthonyLaw AnthonyLaw left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

👍🏼

@AnthonyLaw
AnthonyLaw merged commit 9b8b4b0 into NemProject:dev Aug 4, 2026
5 checks passed
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.

4 participants