Bounded test succeeded; native RandomX miner accepted one block
This commit is contained in:
@@ -26,7 +26,7 @@ function requirePilot(custodianId: string, initializedAt: number): void {
|
||||
if (!Number.isSafeInteger(initializedAt) || initializedAt < 0) throw new Error('Invalid pilot identity initialization time');
|
||||
}
|
||||
|
||||
function identityFromRow(row: Record<string, unknown>): PilotCustodyIdentity {
|
||||
export function pilotCustodyIdentityFromRow(row: Record<string, unknown>): PilotCustodyIdentity {
|
||||
const identity = {
|
||||
version: Number(row.version), mode: row.mode, policy: row.policy,
|
||||
marketNetwork: row.market_network, marketChainId: row.market_chain_id,
|
||||
@@ -78,7 +78,7 @@ export async function initializePilotCustodyIdentity(pool: Pool, custodianId: st
|
||||
await verifyCustodySchema(client);
|
||||
const current = await client.query('SELECT * FROM wk_custody.pilot_custody_identity WHERE singleton=1 FOR UPDATE');
|
||||
if (current.rowCount) {
|
||||
const identity = identityFromRow(current.rows[0]);
|
||||
const identity = pilotCustodyIdentityFromRow(current.rows[0]);
|
||||
if (identity.version !== expected.version || identity.mode !== expected.mode || identity.policy !== expected.policy ||
|
||||
identity.marketNetwork !== expected.marketNetwork || identity.marketChainId !== expected.marketChainId ||
|
||||
identity.moneroNetwork !== expected.moneroNetwork || identity.custodianId !== expected.custodianId) {
|
||||
@@ -103,7 +103,7 @@ export async function verifyPilotCustodyIdentity(pool: Pool, custodianId: string
|
||||
requirePilot(custodianId, 0);
|
||||
const result = await pool.query('SELECT * FROM wk_custody.pilot_custody_identity WHERE singleton=1');
|
||||
if (result.rowCount !== 1) throw new Error('Pilot custody identity is not initialized');
|
||||
const identity = identityFromRow(result.rows[0]);
|
||||
const identity = pilotCustodyIdentityFromRow(result.rows[0]);
|
||||
if (identity.custodianId !== custodianId.toLowerCase()) throw new Error('Pilot custody identity does not match configured custodian');
|
||||
return identity;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user