Skip to content

test(walletapi): add regression test for TokenAdd nil-map guard (PR #44)#2

Open
moralpriest wants to merge 1 commit into
DHEBP:fix/nil-entriesnative-guardfrom
moralpriest:test/tokenadd-nil-guard
Open

test(walletapi): add regression test for TokenAdd nil-map guard (PR #44)#2
moralpriest wants to merge 1 commit into
DHEBP:fix/nil-entriesnative-guardfrom
moralpriest:test/tokenadd-nil-guard

Conversation

@moralpriest

Copy link
Copy Markdown

Adds a regression test (Test_TokenAdd_NilEntriesNative) for the nil-map guard introduced in PR DEROFDN#44 (fix(walletapi): guard TokenAdd against nil EntriesNative map).

The test builds a Wallet_Memory with a bare Account (nil EntriesNative — the fresh/restored, not-yet-synced state) and calls TokenAdd:

  • asserts no panic and that EntriesNative is initialized to a non-nil empty slice,
  • asserts a duplicate scid is rejected with "token already added".

Verification:

  • Panics on community-dev (pre-fix) at wallet.go:157assignment to entry in nil map — reproducing the exact bug.
  • Passes on this branch (post-fix).

No production code changed; this only adds coverage so the panic cannot silently return.

@moralpriest
moralpriest force-pushed the test/tokenadd-nil-guard branch from 2971943 to d351b19 Compare July 15, 2026 21:06
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.

1 participant