Skip to content

Commit

Permalink
feat: Only update network's genesis hash and chain when they're
Browse files Browse the repository at this point in the history
actually fetched from RPC and valid
  • Loading branch information
ashchan committed Nov 16, 2019
1 parent e73d4fe commit 507131b
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/neuron-wallet/src/services/networks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,13 +142,17 @@ export default class NetworksService extends Store {
const chain = await core.rpc
.getBlockchainInfo()
.then(info => info.chain)
.catch(() => 'ckb_dev')
network.chain = chain
.catch(() => '')
if (chain !== '') {
network.chain = chain
}

const genesisHash = await core.rpc
.getBlockHash('0x0')
.catch(() => EMPTY_GENESIS_HASH)
network.genesisHash = genesisHash
if (genesisHash !== EMPTY_GENESIS_HASH) {
network.genesisHash = genesisHash
}
}

this.updateAll(list)
Expand Down

0 comments on commit 507131b

Please sign in to comment.