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/offboard.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/ark/offboard.js') diff --git a/src/ark/offboard.js b/src/ark/offboard.js index 5f10bde..ae6530d 100644 --- a/src/ark/offboard.js +++ b/src/ark/offboard.js @@ -63,13 +63,14 @@ export const feeRateKwu = (satVkb) => Math.floor(satVkb / 4); export function offboardFee({ spkLen, satVkb, fees, tip, inputs }) { const wu = (fees.fixedAdditionalVb + spkLen) * 4; const weightFee = Math.floor((feeRateKwu(satVkb) * wu + 999) / 1000); - let ppmFee = 0; + // pver >= 4: sub-satoshi ppm accumulates across vtxos, one round-up at the end + let ppmUnits = 0; for (const v of inputs) { const blocks = Math.max(0, v.expiryHeight - tip); const entry = [...fees.ppmExpiryTable].reverse().find((e) => blocks >= e.thresholdBlocks); - if (entry) ppmFee += Math.floor((v.amountSat * entry.ppm) / 1_000_000); + if (entry) ppmUnits += v.amountSat * entry.ppm; } - return fees.baseFeeSat + weightFee + ppmFee; + return fees.baseFeeSat + weightFee + Math.ceil(ppmUnits / 1_000_000); } // OffboardRequestAttestation: BIP340 signature over -- cgit v1.2.3