Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(node): fix ssl issues #1427

Merged
merged 3 commits into from
Nov 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion electron-builder.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"artifactName": "${productName}-${version}-${os}-${arch}.${ext}",
"win": {
"icon": "./static/icons/icon1024x1024.ico",
"timeStampServer": "http://timestamp.globalsign.com/scripts/timstamp.dll"
"timeStampServer": "http://timestamp.digicert.com"
},
"linux": {
"icon": "./static/icons/icon1024x1024.png"
Expand Down
9 changes: 7 additions & 2 deletions src/common/util/getRPCEndpoint.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import fetch from 'node-fetch';
import { rpc, settings } from '@cityofzion/neon-js';
import https from 'https';

const httpsAgent = new https.Agent({
rejectUnauthorized: false
});

const BLACKLIST_URL = 'https://raw.githubusercontent.com/nos/rpc-status/master/blacklist.json';

Expand Down Expand Up @@ -29,7 +34,7 @@ async function fetchBlacklist() {
}

try {
const response = await fetch(BLACKLIST_URL);
const response = await fetch(BLACKLIST_URL, { agent: httpsAgent });
cachedBlacklist = await response.json();
return cachedBlacklist;
} catch (err) {
Expand Down Expand Up @@ -63,7 +68,7 @@ function raceToSuccess(promises) {

export default async function getRPCEndpoint(net) {
const apiEndpoint = getAPIEndpoint(net);
const response = await fetch(apiEndpoint);
const response = await fetch(apiEndpoint, { agent: httpsAgent });
const data = await response.json();
let nodes = data.sort((a, b) => b.height - a.height);

Expand Down