upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/src/rpc.cpp
diff options
context:
space:
mode:
authorbitflash-maintainer <noreply@bitflash.invalid>2026-08-09 03:18:25 +0000
committerbitflash-maintainer <noreply@bitflash.invalid>2026-08-23 04:37:36 +0000
commit5abe59dd09e7dbc5795f5f6d9ac2ef303d418134 (patch)
treefbe9bae5e0e5f1ac1cfaa8a486c2d2df5de4193a /src/rpc.cpp
parent857f57e962b24f51621ddac188fa6e42d0ac6f41 (diff)
payout: say what actually failed instead of blaming transaction size
SendMoney's "oversized transaction that requires a transaction fee of 0.00" is not an oversized transaction and there is no fee. That branch is taken when nValue + nFeeRequired > GetBalance() -- an empty spendable balance -- and the fee reads 0.00 because CreateTransaction failed before setting one. 3,267 of these in debug.log sent me looking for a transaction-size problem that does not exist. Report what is short, by how much, and against what balance. Name COINBASE_SPENDABLE_DEPTH in main.h and derive GetBlocksToMaturity from it, because the distinction it captures is genuinely surprising: CMerkleTx::GetCredit values a mined coinbase at zero until COINBASE_MATURITY+20 deep, not COINBASE_MATURITY. I first changed the payout gate to that deeper value, on the theory that each payout was firing 20 blocks before its own coinbase could be spent. Measuring it refuted that: across 934 payments, 96% succeeded at depth 100, the moment they were queued, which is only possible because a payout is funded from whatever coin is already mature rather than from its own block. The gate stays at COINBASE_MATURITY, with a comment recording the measurement so the next person does not re-make the same change. The real shortfall is structural and not addressed here: the pool pays out ~99% of each block's subsidy while only matured coinbases are spendable, so it runs with almost no buffer, and any orphaned block it queued a payout for drains that buffer permanently. The 24h retry loop absorbs this -- 0 payouts forfeited -- but the buffer is what needs fixing. (cherry picked from commit e28df01f90d621b0cd818f28d70a20b8ab5d1a8d)
Diffstat (limited to 'src/rpc.cpp')
-rw-r--r--src/rpc.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/rpc.cpp b/src/rpc.cpp
index 21a8d77..24b1c88 100644
--- a/src/rpc.cpp
+++ b/src/rpc.cpp
@@ -322,6 +322,11 @@ static void QueuePayouts(int blockHeight,
322 int64 minerReward = (int64)((double)nSubsidy * (1.0 - feeFrac)); 322 int64 minerReward = (int64)((double)nSubsidy * (1.0 - feeFrac));
323 323
324 PendingPayout pp; 324 PendingPayout pp;
325 // Deliberately COINBASE_MATURITY, not COINBASE_SPENDABLE_DEPTH: a payout is
326 // funded from whatever coin is already mature, not from its own block's
327 // coinbase, so waiting the extra 20 blocks delays every payment without
328 // making one more likely to succeed. Measured over 934 payments: 96% went
329 // through at depth 100, the moment they were queued.
325 pp.matureAtHeight = blockHeight + COINBASE_MATURITY; 330 pp.matureAtHeight = blockHeight + COINBASE_MATURITY;
326 331
327 int skipped = 0; 332 int skipped = 0;