Skip to content

test: add mainnet probe devtools#940

Draft
piotr-iohk wants to merge 1 commit into
masterfrom
feat/mainnet-probe-devtools
Draft

test: add mainnet probe devtools#940
piotr-iohk wants to merge 1 commit into
masterfrom
feat/mainnet-probe-devtools

Conversation

@piotr-iohk
Copy link
Copy Markdown
Collaborator

Addresses https://github.com/synonymdev/bitkit-nightly/issues/10

Companion PRs:

Description

This PR:

  1. Adds a debug-only devtools command for probing a resolved Lightning invoice through ADB.
  2. Returns structured probe success/failure payloads for the mainnet probe E2E runner.
  3. Adds unit coverage for amount-based probe delegation.

Preview

N/A

QA Notes

Manual Tests

Automated Checks

  • ./gradlew compileDevDebugKotlin
  • ./gradlew testDevDebugUnitTest
  • ./gradlew detekt

Copy link
Copy Markdown
Collaborator

@ovitrif ovitrif left a comment

Choose a reason for hiding this comment

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

Just did a review, for the current state, which is a draft. Added a few nits, and, otherwise, this is a GO and LGTM 👏

I think you can handle this, feel free to continue and ask me for review / help when/if needed.

)

override suspend fun execute(deps: DevToolsProvider.Dependencies): DevResult {
val amountSats = args.amountSats ?: args.amountMsat?.div(1_000u)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nit: try to use args.amountMsat?.let { msatCeilOf(it) } instead of args.amountMsat?.div(1_000u) if it's still satisfying your requirements

context = TAG,
)

return deps.lightningRepo().sendProbeForInvoice(args.bolt11, amountSats)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

caution: This should work, but make sure the app is open and a wallet with LN funds is loaded, otherwise the node will not start and the OP will timeout.


assertTrue(result.isSuccess)
assertEquals(setOf(probePaymentA), result.getOrThrow().paymentIds)
verifyBlocking(lightningService) { sendProbesUsingAmount("lnbc1", 42_000uL) }
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nit: verifyBlocking shouldn't be needed, we're already in a suspend block, that's why we wrap tests in test { … }.

Unfortunately Codex always defaults to prefer it, it's smart but not applicable here.

@ovitrif ovitrif added this to the 2.4.0 milestone May 12, 2026
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