Skip to content

getMempoolApiUrl has no signet or regtest case; signet/regtest nodes query the mainnet mempool API #4781

Open

Description

@kaloudis

UrlUtils.getMempoolApiUrl has cases for a custom instance, Mutinynet, and testnet. There is no signet or regtest case, so on those networks every caller uses the mainnet API unless the user has set a custom mempool instance:

  • FeeStore fee estimates
  • TransactionsStore fee lookup (line 183) and broadcast (line 881)
  • SweepStore UTXO lookup and transaction fetches

For sweeps, getUtxosFromAddress sends a tb1…/bcrt1… address to the mainnet API, the request fails, and the user sees the generic views.Wif.errorFetchingUtxos message with no hint about the cause.

Proposed fix:

  • Signet: return https://mempool.space/signet/api when nodeInfo.isSigNet, checked after isMutinynet. Widen the parameter type to include isSigNet and isRegTest.
  • Regtest: there is no public instance. Without a custom instance, fail with a specific message telling the user to set a custom mempool instance (new en.json string), instead of querying mainnet.

Caveat: a remote node on Mutinynet that reports signet without setting the mutinynet flag would go to the public signet API, which is the wrong chain. Today it goes to mainnet, which is also wrong, but the PR should check which backends set mutinynet.

Tests: getMempoolApiUrl for signet, regtest (with and without a custom instance), and Mutinynet reporting signet.

Reported by @ajaysehwal in #4758 (review). Also listed as out of scope in #4758.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions