Skip to content

Commit

Permalink
fix: use archive node more reliably
Browse files Browse the repository at this point in the history
  • Loading branch information
samsiegart committed Nov 2, 2023
1 parent e5d1484 commit 788cc31
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
10 changes: 1 addition & 9 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,4 @@ export const rpcUrl = agoricNetSubdomain =>
/**
* Look up an archiving version of the host, if available.
*/
export const archivingAlternative = (rpcHost: string) => {
switch (rpcHost) {
case 'https://agoric-rpc.polkachu.com:443':
case 'https://main.rpc.agoric.net:443':
return 'https://main-a.rpc.agoric.net:443';
default:
return rpcHost;
}
};
export const archivingAlternative = (chainName: string, defaultRpc: string) => chainName === 'agoric-3' ? 'https://main-a.rpc.agoric.net:443' : defaultRpc;
6 changes: 3 additions & 3 deletions src/lib/rpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@ export const makeRpcUtils = async ({ agoricNet }) => {
? { rpcAddrs: ['http://localhost:26657'], chainName: 'agoric' }
: await fromAgoricNet(agoricNet);

const { rpcAddrs } = networkConfig;
const { rpcAddrs, chainName } = networkConfig;

const leader = makeLeader(
archivingAlternative(networkConfig.rpcAddrs[0]),
archivingAlternative(chainName, rpcAddrs[0]),
{},
);

Expand All @@ -101,7 +101,7 @@ export const makeRpcUtils = async ({ agoricNet }) => {

const storageWatcher = makeAgoricChainStorageWatcher(
sample(rpcAddrs),
networkConfig.chainName,
chainName,
marshal.unserialize,
);

Expand Down

0 comments on commit 788cc31

Please sign in to comment.