Skip to content

Short circuit invalid nodenum check in ham mode.#10666

Open
vidplace7 wants to merge 1 commit into
developfrom
ham-ghost-nodes
Open

Short circuit invalid nodenum check in ham mode.#10666
vidplace7 wants to merge 1 commit into
developfrom
ham-ghost-nodes

Conversation

@vidplace7

Copy link
Copy Markdown
Member

Currently when ham_mode is enabled, the nodenum is declared invalid and regenerated upon every reboot because isOurOwnEntry uses the publicKey (which doesn't exist in ham mode).

This PR short circuits the invalid nodenum check when ham mode is enabled. Until signing #10478 is implemented, this will prevent the nodenum from being regenerated upon each reboot.

🤝 Attestations

  • I have tested that my proposed changes behave as described.
  • I have tested that my proposed changes do not cause any obvious regressions on the following devices:
    • tbeam-s3-core 144mhz

Until signing is implemented, this will prevent the nodenum from being regenerated upon each reboot.
@vidplace7 vidplace7 added bugfix Pull request that fixes bugs 2.8 labels Jun 10, 2026
@thebentern thebentern requested a review from Copilot June 10, 2026 00:30

Copilot AI 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.

Pull request overview

This PR addresses a ham-mode (licensed mode) boot-time behavior in NodeDB::pickNewNodeNum() where the device’s nodenum can be incorrectly considered “in use” and thus regenerated on every reboot, due to the public-key-based identity check not being applicable in ham mode.

Changes:

  • Add comments clarifying that the public-key identity check is not valid when owner.is_licensed=true (ham mode).
  • Skip the NodeDB/public-key collision check in ham mode to avoid repeated nodenum regeneration.

Comment thread src/mesh/NodeDB.cpp
Comment on lines +1555 to 1565
// Short circuit the check for licensed devices since they do not have public keys to compare against the nodeDB.
if (!owner.is_licensed) {
meshtastic_NodeInfoLite *found;
while (((found = getMeshNode(nodeNum)) && !isOurOwnEntry(found)) ||
(nodeNum == NODENUM_BROADCAST || nodeNum < NUM_RESERVED)) {
NodeNum candidate = random(NUM_RESERVED, LONG_MAX); // try a new random choice
if (found)
LOG_WARN("NOTE! Our desired nodenum 0x%x is invalid or in use, picking 0x%x", nodeNum, candidate);
nodeNum = candidate;
}
}
@vidplace7 vidplace7 requested a review from Xaositek June 10, 2026 00:33
@github-actions

Copy link
Copy Markdown
Contributor

Firmware Size Report

21 targets | no baseline available yet

Target Size
elecrow-adv-35-tft 3,361,648
heltec-ht62-esp32c3-sx1262 2,081,728
heltec-v3 2,206,864
heltec-vision-master-e213-inkhud 2,169,680
pico 736,608
Show 16 more target(s)
Target Size
pico2 729,448
pico2w 1,177,968
picow 1,196,496
rak11200 1,803,200
rak11310 759,192
rak3172 179,604
rak3312 2,213,936
seeed-xiao-s3 2,217,872
seeed_xiao_rp2040 734,808
seeed_xiao_rp2350 727,592
station-g2 2,217,840
station-g3 2,208,496
t-deck-tft 3,753,440
t-eth-elite 2,434,592
tlora-c6 2,315,392
wio-e5 231,940

Updated for 8b45e8a

@vidplace7

Copy link
Copy Markdown
Member Author

This is still needed even after the fix in 309d51a @thebentern

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

Labels

2.8 bugfix Pull request that fixes bugs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants