Skip to content

Commit

Permalink
chore: update dig-sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelTaylor3D committed Sep 26, 2024
1 parent ae7bcc3 commit 7438592
Showing 1 changed file with 19 additions and 11 deletions.
30 changes: 19 additions & 11 deletions src/tasks/payouts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,10 @@ const runIncentiveProgram = async (
while (!payoutMade) {
console.log("Sampling up to 50 peers from the current epoch...");

const serverCoins = await serverCoin.sampleCurrentEpoch(50, peerBlackList);
const serverCoins = await serverCoin.sampleCurrentEpoch(
50,
peerBlackList
);
console.log(`Peers sampled: ${serverCoins.length}`);

if (serverCoins.length === 0) {
Expand All @@ -103,7 +106,9 @@ const runIncentiveProgram = async (
response = await digPeer.contentServer.headStore();
console.log(`Peer ${peerIp} responded to headStore request`);
} catch (error: any) {
console.error(`Failed to connect to peer ${peerIp}: ${error.message}`);
console.error(
`Failed to connect to peer ${peerIp}: ${error.message}`
);
await program.addToBlacklist(peerIp);
continue;
}
Expand Down Expand Up @@ -133,11 +138,12 @@ const runIncentiveProgram = async (
hexKey
)}`
);
const peerChallengeResponse = await digPeer.contentServer.getKey(
hexToUtf8(hexKey),
rootHash,
serializedChallenge
);
const peerChallengeResponse =
await digPeer.contentServer.getKey(
hexToUtf8(hexKey),
rootHash,
serializedChallenge
);
const expectedChallengeResponse =
await digChallenge.createChallengeResponse(challenge);
console.log(
Expand Down Expand Up @@ -177,11 +183,13 @@ const runIncentiveProgram = async (
console.log(`Valid peers found: ${validPeers.length}`);
const paymentAddresses = Array.from(
new Set(
await Promise.all(
validPeers.map(
async (peer) => await peer.contentServer.getPaymentAddress()
(
await Promise.all(
validPeers.map(
async (peer) => await peer.contentServer.getPaymentAddress()
)
)
)
).filter((address) => address !== null)
)
);

Expand Down

0 comments on commit 7438592

Please sign in to comment.