Orgchain v1.6.1: under Last act, a timed beat goes to whoever acted last
A timed or manual beat used to pay the holding being worked in. Now it pays the holding behind the newest cued act or send; with nothing cued, Beat now still pays the one being worked in. At a timed tempo, holdings race for it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01H4upF5LVwmPDDqrhdUfnXh
This commit is contained in:
1 parent
2354947d16
commit
32e8131500
4 files changed
+31
-9
No files matched your search
+9
-1
@@ -8,7 +8,7 @@ import { getVin, getVout } from '../src/upstream/primitives.js';
|
||||
import { MetadataIndex } from '../src/adapters/metadata-index.js';
|
||||
import { lineageEvents, reduce } from '../src/orgchain/lineage.js';
|
||||
import { decodeLab, emptyLab, encodeLab, miningPreference, setRigs, setRule, setTempo, tick } from '../src/orgchain/store.js';
|
||||
import { act, gasCheck, lineageState, minerOf, seedSample, send } from '../src/orgchain/actions.js';
|
||||
import { act, gasCheck, lastHolding, lineageState, minerOf, seedSample, send } from '../src/orgchain/actions.js';
|
||||
import { FEE, PayWallet, REWARD, SAT, balances, brief, btc, ledger, most, owners, payerOf, satsOf, tankOf, tanks } from '../src/orgchain/money.js';
|
||||
import { keyOf } from '../src/orgchain/keys.js';
|
||||
|
||||
@@ -88,6 +88,14 @@ test('beats split across holdings by hashrate, or go whole to the last act', ()
|
||||
act(lab, 'decide', beta, { title: 'Clicked' });
|
||||
assert.deepEqual(mined(6), [['beta', REWARD]]);
|
||||
assert.equal(minerOf(lab, acme).length, 1);
|
||||
setTempo(lab, 30, 1000);
|
||||
act(lab, 'decide', acme, { title: 'First' }, 2000);
|
||||
act(lab, 'decide', beta, { title: 'Last in' }, 3000);
|
||||
assert.equal(lastHolding(lab), beta);
|
||||
assert.equal(tick(lab, 32000, minerOf(lab, lastHolding(lab))), true);
|
||||
assert.deepEqual(mined(7), [['beta', REWARD]]); // the race for a timed beat: whoever acted last takes it
|
||||
assert.equal(lastHolding(lab), null);
|
||||
setTempo(lab, 'each');
|
||||
assert.deepEqual(decodeLab(encodeLab(lab)).mining, { rule: 'last', rigs: { [acme]: 3 } });
|
||||
assert.throws(() => miningPreference({ rule: 'luck' }), /Invalid mining rule/);
|
||||
assert.throws(() => miningPreference({ rigs: { [acme]: 10 } }), /Invalid hashrate/);
|
||||
|
||||
Reference in new issue
Block a user