Skip to content

Commit 183ee2e

Browse files
committed
feat: add trusted peers from blocktank api
1 parent 6b0cc00 commit 183ee2e

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/utils/lightning/index.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1523,8 +1523,16 @@ export const getPeersFromStorage = ({
15231523
return getLightningStore().nodes[selectedWallet].peers[selectedNetwork];
15241524
};
15251525

1526+
/**
1527+
* Adds trusted peers from env file as well as directly from Blocktank API
1528+
*/
15261529
export const addTrustedPeers = async (): Promise<Result<string>> => {
1527-
await lm.setTrustedZeroConfPeerNodeIds(__TRUSTED_ZERO_CONF_PEERS__);
1530+
const btInfo = await getBlocktankInfo(true);
1531+
const btNodeIds = btInfo.nodes.map((n) => n.pubkey);
1532+
1533+
await lm.setTrustedZeroConfPeerNodeIds(
1534+
Array.from(new Set([...btNodeIds, ...__TRUSTED_ZERO_CONF_PEERS__])),
1535+
);
15281536
return ok('Trusted peers added.');
15291537
};
15301538

0 commit comments

Comments
 (0)