From 68fd614f8cb404904e1939ab711f7c7ba4350c32 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Wed, 5 Aug 2026 12:24:03 -0700 Subject: hal speaks pver 5: preimages prove their size, and fees round up as one 0.6.0 servers require the new hashlock clauses (OP_SIZE 32 guard) for Lightning and rounds. New policies/transitions carry the v1 scripts and type bytes; _v0 variants keep old vtxos reconstructing and exiting. The retired third-party HTLC policy is dropped (upstream took 0x08). Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01M5kFodm9azZJVTQxnkDdKe --- src/ark/manager.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/ark/manager.js') diff --git a/src/ark/manager.js b/src/ark/manager.js index f9819a0..a478d19 100644 --- a/src/ark/manager.js +++ b/src/ark/manager.js @@ -1250,14 +1250,17 @@ export class ArkManager { // ---- refresh (also the consolidation primitive) ---- refreshFee(inputs, tip) { + // pver >= 4: ppm accumulates sub-satoshi across ALL inputs and rounds UP + // once at the end (the server's calc_ppm_expiry_fee). Per-input floor — + // the old way — undercharges and the server rejects the round intent. const table = this.info.refreshFees.ppmExpiryTable; - let fee = this.info.refreshFees.baseFeeSat; + let ppmUnits = 0; for (const v of inputs) { const blocks = v.expiryHeight - tip; const entry = table.filter((e) => e.thresholdBlocks <= blocks).pop(); - fee += Math.floor((v.amountSat * (entry?.ppm ?? 0)) / 1_000_000); + ppmUnits += v.amountSat * (entry?.ppm ?? 0); } - return fee; + return this.info.refreshFees.baseFeeSat + Math.ceil(ppmUnits / 1_000_000); } async refresh(vtxoIds) { -- cgit v1.2.3