@@ -321,7 +321,6 @@ export const setupLdk = async ({
321321 } ,
322322 manually_accept_inbound_channels : true ,
323323 } ,
324- trustedZeroConfPeers : __TRUSTED_ZERO_CONF_PEERS__ ,
325324 rapidGossipSyncUrl,
326325 skipParamCheck : true , //Switch off for debugging LDK networking issues
327326 lspLogEvent : async ( payload ) => {
@@ -337,6 +336,7 @@ export const setupLdk = async ({
337336 updateLightningNodeIdThunk ( ) ,
338337 updateLightningNodeVersionThunk ( ) ,
339338 removeUnusedPeers ( { selectedWallet, selectedNetwork } ) ,
339+ addTrustedPeers ( ) ,
340340 ] ) ;
341341 if ( shouldRefreshLdk ) {
342342 const refreshRes = await refreshLdk ( { selectedWallet, selectedNetwork } ) ;
@@ -1523,6 +1523,19 @@ 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+ */
1529+ export const addTrustedPeers = async ( ) : Promise < Result < string > > => {
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+ ) ;
1536+ return ok ( 'Trusted peers added.' ) ;
1537+ } ;
1538+
15261539/**
15271540 * Removes unused peers by comparing saved peers to the channel list to prevent unnecessarily connecting to them on subsequent startups.
15281541 * Will ensure Blocktank's node is not removed if previously added.
0 commit comments