Skip to content

Commit

Permalink
fix: don't create duplicate central price authority
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelfig committed Nov 6, 2020
1 parent dceafd6 commit a7ec3d1
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions packages/cosmic-swingset/lib/ag-solo/vats/bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,12 +164,18 @@ export function buildRootObject(vatPowers, vatParameters) {
issuers.map(async (issuer, i) => {
// Create priceAuthority pairs for centralIssuerIndex based on the
// FakePriceAuthority.
console.error(`Creating ${issuerNames[i]}-${CENTRAL_ISSUER_NAME}`);
console.debug(`Creating ${issuerNames[i]}-${CENTRAL_ISSUER_NAME}`);
const { tradesGivenCentral } = issuerNameToRecord.get(issuerNames[i]);
const tradesGivenThis = tradesGivenCentral.map(([a, b]) => [b, a]);
return Promise.all([
const tradesGivenOther =
centralIssuer !== issuer &&
tradesGivenCentral.map(([valueCentral, valueOther]) => [
valueOther,
valueCentral,
]);
await Promise.all([
makeFakePriceAuthority(centralIssuer, issuer, tradesGivenCentral),
makeFakePriceAuthority(issuer, centralIssuer, tradesGivenThis),
tradesGivenOther &&
makeFakePriceAuthority(issuer, centralIssuer, tradesGivenOther),
]);
}),
);
Expand Down

0 comments on commit a7ec3d1

Please sign in to comment.