Skip to content

feat:align async_order JSON types with rgb-lightning-node dev - #17

Merged
bandrivskiy merged 3 commits into
UTEXO-Protocol:mainfrom
bandrivskiy:feat/fix_types
Jun 2, 2026
Merged

feat:align async_order JSON types with rgb-lightning-node dev#17
bandrivskiy merged 3 commits into
UTEXO-Protocol:mainfrom
bandrivskiy:feat/fix_types

Conversation

@bandrivskiy

Copy link
Copy Markdown
Contributor

fix(apay): align async_order JSON types with rgb-lightning-node dev

Summary

Align utexo-lsp with the current rgb-lightning-node dev branch for APay (Async Payments / Lightning Address): bump the submodule and fix JSON types on POST /internal/async_order/new so they match the RLN contract.

Problem

After moving rgb-lightning-node forward on dev, the async order contract changed:

  • In the async_order.new response, accepted_through_index, next_index_expected, unused_hashes, and refill_batch_size are integers (per openapi.yaml), not strings.
  • In requests from RLN, hash_index in the hash batch may be sent as a JSON number (1), not only as a string ("1").

The previous utexo-lsp code serialized those response fields as string and did not accept numeric hash_index, so the LSP JSON-RPC payload no longer matched what RLN expects/sends. That broke integration tests and recipient hash-pool bootstrap via async_order.new.

The submodule was pinned to 4e8c7f4 (an older dev), missing recent UTEXO changes (gossip, Dockerfile, RLN-side APay updates, etc.).

Changes

internal/lspapi/models.go

  • AsyncOrderNewResponse: AcceptedThroughIndex, NextIndexExpected, UnusedHashes, RefillBatchSize are uint64 instead of string.
  • AsyncOrderNewHashInput.UnmarshalJSON: accepts hash_index as either a string or a number (compatible with RLN serialization).

internal/lspapi/async_order.go

  • asyncOrderSnapshotTx returns numeric fields in the JSON-RPC result (no strconv.FormatInt → string).

internal/lspapi/api_async_order_test.go

  • Assertions updated for uint64.
  • New test TestInternalAsyncOrderNewAcceptsNumericHashIndex for a batch with "hash_index": 1.

Submodule rgb-lightning-node

  • 4e8c7f472b8d10 (UTEXO-Protocol/rgb-lightning-node@devadjust dockerfile and dockerignore #56).
  • Includes the matching rust-lightning revision from that commit.

Comment thread internal/lspapi/api_async_order_test.go Outdated
Comment thread internal/lspapi/models.go Outdated
Comment thread internal/lspapi/models.go Outdated
Comment thread internal/lspapi/models.go Outdated
@txalkan

txalkan commented Jun 1, 2026

Copy link
Copy Markdown
Member

Thank you, @bandrivskiy!
To fix the Python E2E test, please add lsp_base_url=None and lsp_bearer_token=None.

@txalkan txalkan moved this from Todo to In progress in alpha-protocol Jun 1, 2026
@bandrivskiy
bandrivskiy merged commit f481e54 into UTEXO-Protocol:main Jun 2, 2026
1 check passed
@github-project-automation github-project-automation Bot moved this from In progress to Done in alpha-protocol Jun 2, 2026
@bandrivskiy
bandrivskiy deleted the feat/fix_types branch June 2, 2026 08:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants