diff options
| author | Adam Soltys <[email protected]> | 2026-08-05 12:24:03 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-08-05 12:24:03 -0700 |
| commit | 68fd614f8cb404904e1939ab711f7c7ba4350c32 (patch) | |
| tree | 861637d85964802e37211d98d536d35d796ca1bd /src/ark/offboard.js | |
| parent | 1307f8930283393fcf987cfa7e5cfa054676396a (diff) | |
| download | coinosv3-68fd614f8cb404904e1939ab711f7c7ba4350c32.tar.gz coinosv3-68fd614f8cb404904e1939ab711f7c7ba4350c32.zip | |
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 <[email protected]>
Claude-Session: https://claude.ai/code/session_01M5kFodm9azZJVTQxnkDdKe
Diffstat (limited to 'src/ark/offboard.js')
| -rw-r--r-- | src/ark/offboard.js | 7 |
1 files changed, 4 insertions, 3 deletions
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 |
