diff options
Diffstat (limited to 'tools/ark/custody-test.js')
| -rw-r--r-- | tools/ark/custody-test.js | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/tools/ark/custody-test.js b/tools/ark/custody-test.js index da1079c..f8106b7 100644 --- a/tools/ark/custody-test.js +++ b/tools/ark/custody-test.js @@ -9,18 +9,16 @@ import { ArkManager, renewPolicy, CUSTODY_TIERS, MAX_SEND_INPUTS } from '../../s import { validateVtxo, VtxoValidationError } from '../../src/ark/validate.js'; // policies -assert.deepEqual(CUSTODY_TIERS, ['custodial', 'self', 'early']); +assert.deepEqual(CUSTODY_TIERS, ['custodial', 'self', 'exit']); assert.equal(renewPolicy('custodial', 'mainnet'), null, 'the default tier renews nothing'); assert.equal(renewPolicy('nonsense', 'mainnet'), null); assert.deepEqual(renewPolicy('self', 'mainnet'), { window: 96, margin: 36, grid: 48 }); -assert.deepEqual(renewPolicy('early', 'mainnet'), { window: 1008, margin: 1008, grid: 144 }); +assert.deepEqual(renewPolicy('exit', 'mainnet'), { window: 96, margin: 36, grid: 48, maxDepth: 4 }, 'exit = self + a depth trigger'); +assert.deepEqual(renewPolicy('early', 'mainnet'), renewPolicy('exit', 'mainnet'), 'the old name still means the exit tier'); assert.deepEqual(renewPolicy('self', 'regtest'), { window: 24, margin: 6, grid: 1 }); -// the snap never leaves the bracket: self stays under 96 blocks out, early under 2160 -for (let h = 100000; h < 100200; h++) { - const s = h - 36; assert.ok(h - (s - (s % 48)) < 96); - const e = h - 1008; assert.ok(h - (e - (e % 144)) < 2160 && h - (e - (e % 144)) >= 199); -} -console.log('✓ renewal policies: custodial renews nothing; self and early aim inside one fee bracket'); +// the snap never leaves the free bracket: under 96 blocks out +for (let h = 100000; h < 100200; h++) { const s = h - 36; assert.ok(h - (s - (s % 48)) < 96); } +console.log('✓ renewal policies: custodial renews nothing; self and exit aim inside the free bracket'); const mk = (honorsExpired) => { const mgr = new ArkManager({ account: null, storage: { load: () => null, save() {} }, arkUrl: 'http://x', esploraUrl: 'http://y', network: 'mainnet', honorsExpired }); |
