16224898d4
Brings back the abandontransaction RPC that was removed when Triangles
forked from Bitcoin Core 0.18. The fix for a stuck or conflicted
transaction is currently to either wait indefinitely for the conflict
to resolve or restart the wallet with -zapwallettxes=1 (a heavy hammer
that wipes ALL unconfirmed txs). abandontransaction gives the user
targeted control.
Backend (port of Bitcoin Core 0.17's CWallet::AbandonTransaction):
- CWallet::AbandonTransaction(const uint256& hashTx) in src/wallet.{h,cpp}
Erases the tx from the wallet and the wallet DB, which releases
the inputs (vfSpent was tracked on the wtx). Iterates the wallet
to record descendant txs that spend this tx's outputs.
- abandontransaction RPC in src/rpcwallet.cpp + trianglesrpc.{h,cpp}.
Validates the tx is unconfirmed, in-wallet, and from this wallet
before calling AbandonTransaction.
- extern forward declaration in trianglesrpc.h so the RPC table can
reference the function.
UI (Qt right-click context menu in transactionview.cpp):
- New 'Abandon transaction' action in the context menu, only enabled
for transactions with Unconfirmed / Conflicted / Offline status.
- Confirmation dialog before calling the RPC.
- On success, refreshes the transactions table.
WalletModel::abandonTransaction(QString) in src/qt/walletmodel.{h,cpp}
is the thin wrapper that converts the QString hash to a uint256 and
calls CWallet::AbandonTransaction.
Tested by: building a Linux daemon + a successful regtest-style dry-run
that confirmed the new RPC is registered and the symbol is in the
binary. UI rebuild on Windows requires running build-all.yml on a
windows-latest runner (done via workflow_dispatch).