rpc: clarify ALREADY_IN_CHAIN rpc errors

When using `sendrawtransaction` the ALREADY_IN_CHAIN error help string
may be confusing.

Rename TransactionError::ALREADY_IN_CHAIN to
TransactionError::ALREADY_IN_UTXO_SET and update the rpc help string.

Remove backwards compatibility alias as no longer required.
This commit is contained in:
willcl-ark
2024-06-13 08:20:53 +01:00
parent f0d08550a0
commit 87b1880525
8 changed files with 11 additions and 12 deletions

View File

@@ -55,7 +55,7 @@ TransactionError BroadcastTransaction(NodeContext& node, const CTransactionRef t
const Coin& existingCoin = view.AccessCoin(COutPoint(txid, o));
// IsSpent doesn't mean the coin is spent, it means the output doesn't exist.
// So if the output does exist, then this transaction exists in the chain.
if (!existingCoin.IsSpent()) return TransactionError::ALREADY_IN_CHAIN;
if (!existingCoin.IsSpent()) return TransactionError::ALREADY_IN_UTXO_SET;
}
if (auto mempool_tx = node.mempool->get(txid); mempool_tx) {

View File

@@ -19,7 +19,7 @@ namespace node {
enum class TransactionError {
OK, //!< No error
MISSING_INPUTS,
ALREADY_IN_CHAIN,
ALREADY_IN_UTXO_SET,
MEMPOOL_REJECTED,
MEMPOOL_ERROR,
MAX_FEE_EXCEEDED,