Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14864745
D14176.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Subscribers
None
D14176.diff
View Options
diff --git a/apps/ecash-herald/scripts/sendMsgByBlock.js b/apps/ecash-herald/scripts/sendMsgByBlock.js
--- a/apps/ecash-herald/scripts/sendMsgByBlock.js
+++ b/apps/ecash-herald/scripts/sendMsgByBlock.js
@@ -76,10 +76,17 @@
true,
);
- const { blockSummaryTgMsgs, blockSummaryTgMsgsApiFailure } = returnedMocks;
+ const { blockDetails, blockSummaryTgMsgs, blockSummaryTgMsgsApiFailure } =
+ returnedMocks;
+ const blockheight = blockDetails.blockInfo.height;
// Send msg with successful price API call
- await sendBlockSummary(blockSummaryTgMsgs, telegramBot, channelId);
+ await sendBlockSummary(
+ blockSummaryTgMsgs,
+ telegramBot,
+ channelId,
+ blockheight,
+ );
// Send msg with failed price API call
await sendBlockSummary(
diff --git a/apps/ecash-herald/src/events.js b/apps/ecash-herald/src/events.js
--- a/apps/ecash-herald/src/events.js
+++ b/apps/ecash-herald/src/events.js
@@ -25,8 +25,11 @@
// Get some info about this block
let blockDetails = false;
+ let blockheight;
try {
blockDetails = await chronik.block(blockHash);
+ // See blocks.js 'blockDetails' objects for shape of chronik.block return object
+ blockheight = blockDetails.blockInfo.height;
} catch (err) {
console.log(`Error in chronik.block(${blockHash})`, err);
}
@@ -106,6 +109,7 @@
blockSummaryTgMsgs,
telegramBot,
channelId,
+ blockheight,
);
},
};
diff --git a/apps/ecash-herald/src/telegram.js b/apps/ecash-herald/src/telegram.js
--- a/apps/ecash-herald/src/telegram.js
+++ b/apps/ecash-herald/src/telegram.js
@@ -77,7 +77,12 @@
return tgMsgStrings;
},
- sendBlockSummary: async function (tgMsgStrings, telegramBot, channelId) {
+ sendBlockSummary: async function (
+ tgMsgStrings,
+ telegramBot,
+ channelId,
+ blockheight = false,
+ ) {
/* sendBlockSummary
*
* Params
@@ -124,6 +129,10 @@
}
}
if (msgSuccessArray.length === tgMsgStrings.length) {
+ if (typeof blockheight === 'number') {
+ console.log('\x1b[32m%s\x1b[0m', `✔ ${blockheight}`);
+ }
+
return msgSuccessArray;
}
// Catch potential edge case
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, May 20, 22:07 (18 h, 14 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5866021
Default Alt Text
D14176.diff (2 KB)
Attached To
D14176: [ecash-herald] Log success msgs by blockheight
Event Timeline
Log In to Comment