Surface "too-long-mempool-chain" in send/sendtoaddress RPC error

Surface the correct mempool error when submitting a transaction through the RPC interface.
Check Out Task
Task Bounty Details


Bitcoin Issue


Estimated Effort


Current Status


Paid in USD or equivalent BTC upon acceptance

Bitcoin Issue

When a transaction is constructed through the RPC interface, it is submitted to the mempool for broadcast. The mempool has certain limits on how many descendants or ancestors a transaction can have, and in certain cases a transaction generated by bitcoind's wallet may fail these checks.

The current error surfaced by the RPC interface in this case is misleading.

From the original issue:

If coin selection fails as part of send or sendtoaddress, the error message returned to the RPC client is Insufficient funds, even if the actual cause is due to too-long-mempool-chain. This is likely to alarm users unnecessarily, as they will believe this means their funds have permanently vanished rather than being temporarily inaccessible.

If coin selection fails due to too-long-mempool-chain, the send and sendtoaddress methods should pass that error back to the RPC client, instead of Insufficient funds.

The related code is here.

Prerequisite Skills

C++, Bitcoin Wallet

Code Guidelines

Repository Code Guidelines Page

Definition of Done

Get a PR merged which closes the original issue. Include unit-test coverage.

Check Out Task