Page MenuHomePhabricator

[ecash-herald] Send daily summaries covering exact 24-hr windows
ClosedPublic

Authored by bytesofman on Oct 15 2024, 23:45.

Details

Summary

We get better information getting on chain activity by timestamp instead of block. In this way, we can tell if blocks are coming "too fast" or "too slow."

We also are always covering a fixed timespan, so daily messages are actually daily messages. So, we can learn more by comparing them against each other.

Test Plan

npm test, node scripts/getDailySummary.js

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Failed tests logs:

====== parse.js functions: summarizeTxHistory summarizes a collection of txs across multiple blocks including fiat prices.parse.js functions summarizeTxHistory summarizes a collection of txs across multiple blocks including fiat prices ======
AssertionError: Expected values to be loosely deep-equal:  [   '<b>74 blocks in 24 hours thru 14 Oct 2024, 07:00</b>\n' +     '\n' +     '3 miners found blocks\n' +     '<u>Top 3</u>\n' +     '1. Mining-Dutch, 1 (1%)\n' +     '2. solopool.org, 1 (1%)\n' +     '3. ViaBTC, 1 (1%)\n' +     '\n' +     '3 stakers earned $31\n' +     '<u>Top 3</u>\n' +     '1. <a href="https://explorer.e.cash/address/ecash:qzs8hq2pj4hu5j09fdr5uhha3986h2mthvfp7362nu">qzs...2nu</a>, 1 (1%)\n' +     '2. <a href="https://explorer.e.cash/address/ecash:qr42c8c04tqndscfrdnl0rzterg0qdaegyjzt8...  should loosely deep-equal  [   '<b>74 blocks in 24 hours thru 14 Oct 2024, 00:00</b>\n' +     '\n' +     '3 miners found blocks\n' +     '<u>Top 3</u>\n' +     '1. Mining-Dutch, 1 (1%)\n' +     '2. solopool.org, 1 (1%)\n' +     '3. ViaBTC, 1 (1%)\n' +     '\n' +     '3 stakers earned $31\n' +     '<u>Top 3</u>\n' +     '1. <a href="https://explorer.e.cash/address/ecash:qzs8hq2pj4hu5j09fdr5uhha3986h2mthvfp7362nu">qzs...2nu</a>, 1 (1%)\n' +     '2. <a href="https://explorer.e.cash/address/ecash:qr42c8c04tqndscfrdnl0rzterg0qdaegyjzt8...
AssertionError [ERR_ASSERTION]: Expected values to be loosely deep-equal:

[
  '<b>74 blocks in 24 hours thru 14 Oct 2024, 07:00</b>\n' +
    '\n' +
    '3 miners found blocks\n' +
    '<u>Top 3</u>\n' +
    '1. Mining-Dutch, 1 (1%)\n' +
    '2. solopool.org, 1 (1%)\n' +
    '3. ViaBTC, 1 (1%)\n' +
    '\n' +
    '3 stakers earned $31\n' +
    '<u>Top 3</u>\n' +
    '1. <a href="https://explorer.e.cash/address/ecash:qzs8hq2pj4hu5j09fdr5uhha3986h2mthvfp7362nu">qzs...2nu</a>, 1 (1%)\n' +
    '2. <a href="https://explorer.e.cash/address/ecash:qr42c8c04tqndscfrdnl0rzterg0qdaegyjzt8...

should loosely deep-equal

[
  '<b>74 blocks in 24 hours thru 14 Oct 2024, 00:00</b>\n' +
    '\n' +
    '3 miners found blocks\n' +
    '<u>Top 3</u>\n' +
    '1. Mining-Dutch, 1 (1%)\n' +
    '2. solopool.org, 1 (1%)\n' +
    '3. ViaBTC, 1 (1%)\n' +
    '\n' +
    '3 stakers earned $31\n' +
    '<u>Top 3</u>\n' +
    '1. <a href="https://explorer.e.cash/address/ecash:qzs8hq2pj4hu5j09fdr5uhha3986h2mthvfp7362nu">qzs...2nu</a>, 1 (1%)\n' +
    '2. <a href="https://explorer.e.cash/address/ecash:qr42c8c04tqndscfrdnl0rzterg0qdaegyjzt8...
    at Context.<anonymous> (test/parse.test.js:354:16)
    at process.processImmediate (node:internal/timers:483:21)

      + expected - actual

       [
      -  "<b>74 blocks in 24 hours thru 14 Oct 2024, 07:00</b>\n\n3 miners found blocks\n<u>Top 3</u>\n1. Mining-Dutch, 1 (1%)\n2. solopool.org, 1 (1%)\n3. ViaBTC, 1 (1%)\n\n3 stakers earned $31\n<u>Top 3</u>\n1. <a href=\"https://explorer.e.cash/address/ecash:qzs8hq2pj4hu5j09fdr5uhha3986h2mthvfp7362nu\">qzs...2nu</a>, 1 (1%)\n2. <a href=\"https://explorer.e.cash/address/ecash:qr42c8c04tqndscfrdnl0rzterg0qdaegyjzt8egyg\">qr4...gyg</a>, 1 (1%)\n3. <a href=\"https://explorer.e.cash/address/ecash:qqvhatumna957qu0je78dnc9pc7c7hu89crkq6k0cd\">qqv...0cd</a>, 1 (1%)\n\n8 txs\n1 new Cashtab user claimed 42 free XEC\n1 Cashtab user claimed 100.00 CACHET\n1 CashFusion tx\n1 token tx\n1 app tx\n\nBinance Hot Wallet\n1 withdrawals totaling $1"
      +  "<b>74 blocks in 24 hours thru 14 Oct 2024, 00:00</b>\n\n3 miners found blocks\n<u>Top 3</u>\n1. Mining-Dutch, 1 (1%)\n2. solopool.org, 1 (1%)\n3. ViaBTC, 1 (1%)\n\n3 stakers earned $31\n<u>Top 3</u>\n1. <a href=\"https://explorer.e.cash/address/ecash:qzs8hq2pj4hu5j09fdr5uhha3986h2mthvfp7362nu\">qzs...2nu</a>, 1 (1%)\n2. <a href=\"https://explorer.e.cash/address/ecash:qr42c8c04tqndscfrdnl0rzterg0qdaegyjzt8egyg\">qr4...gyg</a>, 1 (1%)\n3. <a href=\"https://explorer.e.cash/address/ecash:qqvhatumna957qu0je78dnc9pc7c7hu89crkq6k0cd\">qqv...0cd</a>, 1 (1%)\n\n8 txs\n1 new Cashtab user claimed 42 free XEC\n1 Cashtab user claimed 100.00 CACHET\n1 CashFusion tx\n1 token tx\n1 app tx\n\nBinance Hot Wallet\n1 withdrawals totaling $1"
       ]
====== parse.js functions: summarizeTxHistory summarizes a collection of txs across multiple blocks without fiat price.parse.js functions summarizeTxHistory summarizes a collection of txs across multiple blocks without fiat price ======
AssertionError: Expected values to be loosely deep-equal:  [   '<b>74 blocks in 24 hours thru 14 Oct 2024, 07:00</b>\n' +     '\n' +     '3 miners found blocks\n' +     '<u>Top 3</u>\n' +     '1. Mining-Dutch, 1 (1%)\n' +     '2. solopool.org, 1 (1%)\n' +     '3. ViaBTC, 1 (1%)\n' +     '\n' +     '3 stakers earned 937,620 XEC\n' +     '<u>Top 3</u>\n' +     '1. <a href="https://explorer.e.cash/address/ecash:qzs8hq2pj4hu5j09fdr5uhha3986h2mthvfp7362nu">qzs...2nu</a>, 1 (1%)\n' +     '2. <a href="https://explorer.e.cash/address/ecash:qr42c8c04tqndscfrdnl0rzterg0qd...  should loosely deep-equal  [   '<b>74 blocks in 24 hours thru 14 Oct 2024, 00:00</b>\n' +     '\n' +     '3 miners found blocks\n' +     '<u>Top 3</u>\n' +     '1. Mining-Dutch, 1 (1%)\n' +     '2. solopool.org, 1 (1%)\n' +     '3. ViaBTC, 1 (1%)\n' +     '\n' +     '3 stakers earned 937,620 XEC\n' +     '<u>Top 3</u>\n' +     '1. <a href="https://explorer.e.cash/address/ecash:qzs8hq2pj4hu5j09fdr5uhha3986h2mthvfp7362nu">qzs...2nu</a>, 1 (1%)\n' +     '2. <a href="https://explorer.e.cash/address/ecash:qr42c8c04tqndscfrdnl0rzterg0qd...
AssertionError [ERR_ASSERTION]: Expected values to be loosely deep-equal:

[
  '<b>74 blocks in 24 hours thru 14 Oct 2024, 07:00</b>\n' +
    '\n' +
    '3 miners found blocks\n' +
    '<u>Top 3</u>\n' +
    '1. Mining-Dutch, 1 (1%)\n' +
    '2. solopool.org, 1 (1%)\n' +
    '3. ViaBTC, 1 (1%)\n' +
    '\n' +
    '3 stakers earned 937,620 XEC\n' +
    '<u>Top 3</u>\n' +
    '1. <a href="https://explorer.e.cash/address/ecash:qzs8hq2pj4hu5j09fdr5uhha3986h2mthvfp7362nu">qzs...2nu</a>, 1 (1%)\n' +
    '2. <a href="https://explorer.e.cash/address/ecash:qr42c8c04tqndscfrdnl0rzterg0qd...

should loosely deep-equal

[
  '<b>74 blocks in 24 hours thru 14 Oct 2024, 00:00</b>\n' +
    '\n' +
    '3 miners found blocks\n' +
    '<u>Top 3</u>\n' +
    '1. Mining-Dutch, 1 (1%)\n' +
    '2. solopool.org, 1 (1%)\n' +
    '3. ViaBTC, 1 (1%)\n' +
    '\n' +
    '3 stakers earned 937,620 XEC\n' +
    '<u>Top 3</u>\n' +
    '1. <a href="https://explorer.e.cash/address/ecash:qzs8hq2pj4hu5j09fdr5uhha3986h2mthvfp7362nu">qzs...2nu</a>, 1 (1%)\n' +
    '2. <a href="https://explorer.e.cash/address/ecash:qr42c8c04tqndscfrdnl0rzterg0qd...
    at Context.<anonymous> (test/parse.test.js:389:16)
    at process.processImmediate (node:internal/timers:483:21)

      + expected - actual

       [
      -  "<b>74 blocks in 24 hours thru 14 Oct 2024, 07:00</b>\n\n3 miners found blocks\n<u>Top 3</u>\n1. Mining-Dutch, 1 (1%)\n2. solopool.org, 1 (1%)\n3. ViaBTC, 1 (1%)\n\n3 stakers earned 937,620 XEC\n<u>Top 3</u>\n1. <a href=\"https://explorer.e.cash/address/ecash:qzs8hq2pj4hu5j09fdr5uhha3986h2mthvfp7362nu\">qzs...2nu</a>, 1 (1%)\n2. <a href=\"https://explorer.e.cash/address/ecash:qr42c8c04tqndscfrdnl0rzterg0qdaegyjzt8egyg\">qr4...gyg</a>, 1 (1%)\n3. <a href=\"https://explorer.e.cash/address/ecash:qqvhatumna957qu0je78dnc9pc7c7hu89crkq6k0cd\">qqv...0cd</a>, 1 (1%)\n\n8 txs\n1 new Cashtab user claimed 42 free XEC\n1 Cashtab user claimed 100.00 CACHET\n1 CashFusion tx\n1 token tx\n1 app tx\n\nBinance Hot Wallet\n1 withdrawals totaling 19,720 XEC"
      +  "<b>74 blocks in 24 hours thru 14 Oct 2024, 00:00</b>\n\n3 miners found blocks\n<u>Top 3</u>\n1. Mining-Dutch, 1 (1%)\n2. solopool.org, 1 (1%)\n3. ViaBTC, 1 (1%)\n\n3 stakers earned 937,620 XEC\n<u>Top 3</u>\n1. <a href=\"https://explorer.e.cash/address/ecash:qzs8hq2pj4hu5j09fdr5uhha3986h2mthvfp7362nu\">qzs...2nu</a>, 1 (1%)\n2. <a href=\"https://explorer.e.cash/address/ecash:qr42c8c04tqndscfrdnl0rzterg0qdaegyjzt8egyg\">qr4...gyg</a>, 1 (1%)\n3. <a href=\"https://explorer.e.cash/address/ecash:qqvhatumna957qu0je78dnc9pc7c7hu89crkq6k0cd\">qqv...0cd</a>, 1 (1%)\n\n8 txs\n1 new Cashtab user claimed 42 free XEC\n1 Cashtab user claimed 100.00 CACHET\n1 CashFusion tx\n1 token tx\n1 app tx\n\nBinance Hot Wallet\n1 withdrawals totaling 19,720 XEC"
       ]

Each failure log is accessible here:
parse.js functions: summarizeTxHistory summarizes a collection of txs across multiple blocks including fiat prices.parse.js functions summarizeTxHistory summarizes a collection of txs across multiple blocks including fiat prices
parse.js functions: summarizeTxHistory summarizes a collection of txs across multiple blocks without fiat price.parse.js functions summarizeTxHistory summarizes a collection of txs across multiple blocks without fiat price

better function names, clean up unused return values, better comments

Failed tests logs:

====== parse.js functions: summarizeTxHistory summarizes a collection of txs across multiple blocks including fiat prices.parse.js functions summarizeTxHistory summarizes a collection of txs across multiple blocks including fiat prices ======
AssertionError: Expected values to be loosely deep-equal:  [   '<b>74 blocks in 24 hours thru 14 Oct 2024, 07:00</b>\n' +     '\n' +     '3 miners found blocks\n' +     '<u>Top 3</u>\n' +     '1. Mining-Dutch, 1 (1%)\n' +     '2. solopool.org, 1 (1%)\n' +     '3. ViaBTC, 1 (1%)\n' +     '\n' +     '3 stakers earned $31\n' +     '<u>Top 3</u>\n' +     '1. <a href="https://explorer.e.cash/address/ecash:qzs8hq2pj4hu5j09fdr5uhha3986h2mthvfp7362nu">qzs...2nu</a>, 1 (1%)\n' +     '2. <a href="https://explorer.e.cash/address/ecash:qr42c8c04tqndscfrdnl0rzterg0qdaegyjzt8...  should loosely deep-equal  [   '<b>74 blocks in 24 hours thru 14 Oct 2024, 00:00</b>\n' +     '\n' +     '3 miners found blocks\n' +     '<u>Top 3</u>\n' +     '1. Mining-Dutch, 1 (1%)\n' +     '2. solopool.org, 1 (1%)\n' +     '3. ViaBTC, 1 (1%)\n' +     '\n' +     '3 stakers earned $31\n' +     '<u>Top 3</u>\n' +     '1. <a href="https://explorer.e.cash/address/ecash:qzs8hq2pj4hu5j09fdr5uhha3986h2mthvfp7362nu">qzs...2nu</a>, 1 (1%)\n' +     '2. <a href="https://explorer.e.cash/address/ecash:qr42c8c04tqndscfrdnl0rzterg0qdaegyjzt8...
AssertionError [ERR_ASSERTION]: Expected values to be loosely deep-equal:

[
  '<b>74 blocks in 24 hours thru 14 Oct 2024, 07:00</b>\n' +
    '\n' +
    '3 miners found blocks\n' +
    '<u>Top 3</u>\n' +
    '1. Mining-Dutch, 1 (1%)\n' +
    '2. solopool.org, 1 (1%)\n' +
    '3. ViaBTC, 1 (1%)\n' +
    '\n' +
    '3 stakers earned $31\n' +
    '<u>Top 3</u>\n' +
    '1. <a href="https://explorer.e.cash/address/ecash:qzs8hq2pj4hu5j09fdr5uhha3986h2mthvfp7362nu">qzs...2nu</a>, 1 (1%)\n' +
    '2. <a href="https://explorer.e.cash/address/ecash:qr42c8c04tqndscfrdnl0rzterg0qdaegyjzt8...

should loosely deep-equal

[
  '<b>74 blocks in 24 hours thru 14 Oct 2024, 00:00</b>\n' +
    '\n' +
    '3 miners found blocks\n' +
    '<u>Top 3</u>\n' +
    '1. Mining-Dutch, 1 (1%)\n' +
    '2. solopool.org, 1 (1%)\n' +
    '3. ViaBTC, 1 (1%)\n' +
    '\n' +
    '3 stakers earned $31\n' +
    '<u>Top 3</u>\n' +
    '1. <a href="https://explorer.e.cash/address/ecash:qzs8hq2pj4hu5j09fdr5uhha3986h2mthvfp7362nu">qzs...2nu</a>, 1 (1%)\n' +
    '2. <a href="https://explorer.e.cash/address/ecash:qr42c8c04tqndscfrdnl0rzterg0qdaegyjzt8...
    at Context.<anonymous> (test/parse.test.js:354:16)
    at process.processImmediate (node:internal/timers:483:21)

      + expected - actual

       [
      -  "<b>74 blocks in 24 hours thru 14 Oct 2024, 07:00</b>\n\n3 miners found blocks\n<u>Top 3</u>\n1. Mining-Dutch, 1 (1%)\n2. solopool.org, 1 (1%)\n3. ViaBTC, 1 (1%)\n\n3 stakers earned $31\n<u>Top 3</u>\n1. <a href=\"https://explorer.e.cash/address/ecash:qzs8hq2pj4hu5j09fdr5uhha3986h2mthvfp7362nu\">qzs...2nu</a>, 1 (1%)\n2. <a href=\"https://explorer.e.cash/address/ecash:qr42c8c04tqndscfrdnl0rzterg0qdaegyjzt8egyg\">qr4...gyg</a>, 1 (1%)\n3. <a href=\"https://explorer.e.cash/address/ecash:qqvhatumna957qu0je78dnc9pc7c7hu89crkq6k0cd\">qqv...0cd</a>, 1 (1%)\n\n8 txs\n1 new Cashtab user claimed 42 free XEC\n1 Cashtab user claimed 100.00 CACHET\n1 CashFusion tx\n1 token tx\n1 app tx\n\nBinance Hot Wallet\n1 withdrawals totaling $1"
      +  "<b>74 blocks in 24 hours thru 14 Oct 2024, 00:00</b>\n\n3 miners found blocks\n<u>Top 3</u>\n1. Mining-Dutch, 1 (1%)\n2. solopool.org, 1 (1%)\n3. ViaBTC, 1 (1%)\n\n3 stakers earned $31\n<u>Top 3</u>\n1. <a href=\"https://explorer.e.cash/address/ecash:qzs8hq2pj4hu5j09fdr5uhha3986h2mthvfp7362nu\">qzs...2nu</a>, 1 (1%)\n2. <a href=\"https://explorer.e.cash/address/ecash:qr42c8c04tqndscfrdnl0rzterg0qdaegyjzt8egyg\">qr4...gyg</a>, 1 (1%)\n3. <a href=\"https://explorer.e.cash/address/ecash:qqvhatumna957qu0je78dnc9pc7c7hu89crkq6k0cd\">qqv...0cd</a>, 1 (1%)\n\n8 txs\n1 new Cashtab user claimed 42 free XEC\n1 Cashtab user claimed 100.00 CACHET\n1 CashFusion tx\n1 token tx\n1 app tx\n\nBinance Hot Wallet\n1 withdrawals totaling $1"
       ]
====== parse.js functions: summarizeTxHistory summarizes a collection of txs across multiple blocks without fiat price.parse.js functions summarizeTxHistory summarizes a collection of txs across multiple blocks without fiat price ======
AssertionError: Expected values to be loosely deep-equal:  [   '<b>74 blocks in 24 hours thru 14 Oct 2024, 07:00</b>\n' +     '\n' +     '3 miners found blocks\n' +     '<u>Top 3</u>\n' +     '1. Mining-Dutch, 1 (1%)\n' +     '2. solopool.org, 1 (1%)\n' +     '3. ViaBTC, 1 (1%)\n' +     '\n' +     '3 stakers earned 937,620 XEC\n' +     '<u>Top 3</u>\n' +     '1. <a href="https://explorer.e.cash/address/ecash:qzs8hq2pj4hu5j09fdr5uhha3986h2mthvfp7362nu">qzs...2nu</a>, 1 (1%)\n' +     '2. <a href="https://explorer.e.cash/address/ecash:qr42c8c04tqndscfrdnl0rzterg0qd...  should loosely deep-equal  [   '<b>74 blocks in 24 hours thru 14 Oct 2024, 00:00</b>\n' +     '\n' +     '3 miners found blocks\n' +     '<u>Top 3</u>\n' +     '1. Mining-Dutch, 1 (1%)\n' +     '2. solopool.org, 1 (1%)\n' +     '3. ViaBTC, 1 (1%)\n' +     '\n' +     '3 stakers earned 937,620 XEC\n' +     '<u>Top 3</u>\n' +     '1. <a href="https://explorer.e.cash/address/ecash:qzs8hq2pj4hu5j09fdr5uhha3986h2mthvfp7362nu">qzs...2nu</a>, 1 (1%)\n' +     '2. <a href="https://explorer.e.cash/address/ecash:qr42c8c04tqndscfrdnl0rzterg0qd...
AssertionError [ERR_ASSERTION]: Expected values to be loosely deep-equal:

[
  '<b>74 blocks in 24 hours thru 14 Oct 2024, 07:00</b>\n' +
    '\n' +
    '3 miners found blocks\n' +
    '<u>Top 3</u>\n' +
    '1. Mining-Dutch, 1 (1%)\n' +
    '2. solopool.org, 1 (1%)\n' +
    '3. ViaBTC, 1 (1%)\n' +
    '\n' +
    '3 stakers earned 937,620 XEC\n' +
    '<u>Top 3</u>\n' +
    '1. <a href="https://explorer.e.cash/address/ecash:qzs8hq2pj4hu5j09fdr5uhha3986h2mthvfp7362nu">qzs...2nu</a>, 1 (1%)\n' +
    '2. <a href="https://explorer.e.cash/address/ecash:qr42c8c04tqndscfrdnl0rzterg0qd...

should loosely deep-equal

[
  '<b>74 blocks in 24 hours thru 14 Oct 2024, 00:00</b>\n' +
    '\n' +
    '3 miners found blocks\n' +
    '<u>Top 3</u>\n' +
    '1. Mining-Dutch, 1 (1%)\n' +
    '2. solopool.org, 1 (1%)\n' +
    '3. ViaBTC, 1 (1%)\n' +
    '\n' +
    '3 stakers earned 937,620 XEC\n' +
    '<u>Top 3</u>\n' +
    '1. <a href="https://explorer.e.cash/address/ecash:qzs8hq2pj4hu5j09fdr5uhha3986h2mthvfp7362nu">qzs...2nu</a>, 1 (1%)\n' +
    '2. <a href="https://explorer.e.cash/address/ecash:qr42c8c04tqndscfrdnl0rzterg0qd...
    at Context.<anonymous> (test/parse.test.js:389:16)
    at process.processImmediate (node:internal/timers:483:21)

      + expected - actual

       [
      -  "<b>74 blocks in 24 hours thru 14 Oct 2024, 07:00</b>\n\n3 miners found blocks\n<u>Top 3</u>\n1. Mining-Dutch, 1 (1%)\n2. solopool.org, 1 (1%)\n3. ViaBTC, 1 (1%)\n\n3 stakers earned 937,620 XEC\n<u>Top 3</u>\n1. <a href=\"https://explorer.e.cash/address/ecash:qzs8hq2pj4hu5j09fdr5uhha3986h2mthvfp7362nu\">qzs...2nu</a>, 1 (1%)\n2. <a href=\"https://explorer.e.cash/address/ecash:qr42c8c04tqndscfrdnl0rzterg0qdaegyjzt8egyg\">qr4...gyg</a>, 1 (1%)\n3. <a href=\"https://explorer.e.cash/address/ecash:qqvhatumna957qu0je78dnc9pc7c7hu89crkq6k0cd\">qqv...0cd</a>, 1 (1%)\n\n8 txs\n1 new Cashtab user claimed 42 free XEC\n1 Cashtab user claimed 100.00 CACHET\n1 CashFusion tx\n1 token tx\n1 app tx\n\nBinance Hot Wallet\n1 withdrawals totaling 19,720 XEC"
      +  "<b>74 blocks in 24 hours thru 14 Oct 2024, 00:00</b>\n\n3 miners found blocks\n<u>Top 3</u>\n1. Mining-Dutch, 1 (1%)\n2. solopool.org, 1 (1%)\n3. ViaBTC, 1 (1%)\n\n3 stakers earned 937,620 XEC\n<u>Top 3</u>\n1. <a href=\"https://explorer.e.cash/address/ecash:qzs8hq2pj4hu5j09fdr5uhha3986h2mthvfp7362nu\">qzs...2nu</a>, 1 (1%)\n2. <a href=\"https://explorer.e.cash/address/ecash:qr42c8c04tqndscfrdnl0rzterg0qdaegyjzt8egyg\">qr4...gyg</a>, 1 (1%)\n3. <a href=\"https://explorer.e.cash/address/ecash:qqvhatumna957qu0je78dnc9pc7c7hu89crkq6k0cd\">qqv...0cd</a>, 1 (1%)\n\n8 txs\n1 new Cashtab user claimed 42 free XEC\n1 Cashtab user claimed 100.00 CACHET\n1 CashFusion tx\n1 token tx\n1 app tx\n\nBinance Hot Wallet\n1 withdrawals totaling 19,720 XEC"
       ]

Each failure log is accessible here:
parse.js functions: summarizeTxHistory summarizes a collection of txs across multiple blocks including fiat prices.parse.js functions summarizeTxHistory summarizes a collection of txs across multiple blocks including fiat prices
parse.js functions: summarizeTxHistory summarizes a collection of txs across multiple blocks without fiat price.parse.js functions summarizeTxHistory summarizes a collection of txs across multiple blocks without fiat price

Failed tests logs:

====== parse.js functions: summarizeTxHistory summarizes a collection of txs across multiple blocks including fiat prices.parse.js functions summarizeTxHistory summarizes a collection of txs across multiple blocks including fiat prices ======
AssertionError: Expected values to be loosely deep-equal:  [   '<b>74 blocks in 24 hours thru 14 Oct 2024, 07:00</b>\n' +     '\n' +     '3 miners found blocks\n' +     '<u>Top 3</u>\n' +     '1. Mining-Dutch, 1 (1%)\n' +     '2. solopool.org, 1 (1%)\n' +     '3. ViaBTC, 1 (1%)\n' +     '\n' +     '3 stakers earned $31\n' +     '<u>Top 3</u>\n' +     '1. <a href="https://explorer.e.cash/address/ecash:qzs8hq2pj4hu5j09fdr5uhha3986h2mthvfp7362nu">qzs...2nu</a>, 1 (1%)\n' +     '2. <a href="https://explorer.e.cash/address/ecash:qr42c8c04tqndscfrdnl0rzterg0qdaegyjzt8...  should loosely deep-equal  [   '<b>74 blocks in 24 hours thru 14 Oct 2024, 00:00</b>\n' +     '\n' +     '3 miners found blocks\n' +     '<u>Top 3</u>\n' +     '1. Mining-Dutch, 1 (1%)\n' +     '2. solopool.org, 1 (1%)\n' +     '3. ViaBTC, 1 (1%)\n' +     '\n' +     '3 stakers earned $31\n' +     '<u>Top 3</u>\n' +     '1. <a href="https://explorer.e.cash/address/ecash:qzs8hq2pj4hu5j09fdr5uhha3986h2mthvfp7362nu">qzs...2nu</a>, 1 (1%)\n' +     '2. <a href="https://explorer.e.cash/address/ecash:qr42c8c04tqndscfrdnl0rzterg0qdaegyjzt8...
AssertionError [ERR_ASSERTION]: Expected values to be loosely deep-equal:

[
  '<b>74 blocks in 24 hours thru 14 Oct 2024, 07:00</b>\n' +
    '\n' +
    '3 miners found blocks\n' +
    '<u>Top 3</u>\n' +
    '1. Mining-Dutch, 1 (1%)\n' +
    '2. solopool.org, 1 (1%)\n' +
    '3. ViaBTC, 1 (1%)\n' +
    '\n' +
    '3 stakers earned $31\n' +
    '<u>Top 3</u>\n' +
    '1. <a href="https://explorer.e.cash/address/ecash:qzs8hq2pj4hu5j09fdr5uhha3986h2mthvfp7362nu">qzs...2nu</a>, 1 (1%)\n' +
    '2. <a href="https://explorer.e.cash/address/ecash:qr42c8c04tqndscfrdnl0rzterg0qdaegyjzt8...

should loosely deep-equal

[
  '<b>74 blocks in 24 hours thru 14 Oct 2024, 00:00</b>\n' +
    '\n' +
    '3 miners found blocks\n' +
    '<u>Top 3</u>\n' +
    '1. Mining-Dutch, 1 (1%)\n' +
    '2. solopool.org, 1 (1%)\n' +
    '3. ViaBTC, 1 (1%)\n' +
    '\n' +
    '3 stakers earned $31\n' +
    '<u>Top 3</u>\n' +
    '1. <a href="https://explorer.e.cash/address/ecash:qzs8hq2pj4hu5j09fdr5uhha3986h2mthvfp7362nu">qzs...2nu</a>, 1 (1%)\n' +
    '2. <a href="https://explorer.e.cash/address/ecash:qr42c8c04tqndscfrdnl0rzterg0qdaegyjzt8...
    at Context.<anonymous> (test/parse.test.js:354:16)
    at process.processImmediate (node:internal/timers:483:21)

      + expected - actual

       [
      -  "<b>74 blocks in 24 hours thru 14 Oct 2024, 07:00</b>\n\n3 miners found blocks\n<u>Top 3</u>\n1. Mining-Dutch, 1 (1%)\n2. solopool.org, 1 (1%)\n3. ViaBTC, 1 (1%)\n\n3 stakers earned $31\n<u>Top 3</u>\n1. <a href=\"https://explorer.e.cash/address/ecash:qzs8hq2pj4hu5j09fdr5uhha3986h2mthvfp7362nu\">qzs...2nu</a>, 1 (1%)\n2. <a href=\"https://explorer.e.cash/address/ecash:qr42c8c04tqndscfrdnl0rzterg0qdaegyjzt8egyg\">qr4...gyg</a>, 1 (1%)\n3. <a href=\"https://explorer.e.cash/address/ecash:qqvhatumna957qu0je78dnc9pc7c7hu89crkq6k0cd\">qqv...0cd</a>, 1 (1%)\n\n8 txs\n1 new Cashtab user claimed 42 free XEC\n1 Cashtab user claimed 100.00 CACHET\n1 CashFusion tx\n1 token tx\n1 app tx\n\nBinance Hot Wallet\n1 withdrawals totaling $1"
      +  "<b>74 blocks in 24 hours thru 14 Oct 2024, 00:00</b>\n\n3 miners found blocks\n<u>Top 3</u>\n1. Mining-Dutch, 1 (1%)\n2. solopool.org, 1 (1%)\n3. ViaBTC, 1 (1%)\n\n3 stakers earned $31\n<u>Top 3</u>\n1. <a href=\"https://explorer.e.cash/address/ecash:qzs8hq2pj4hu5j09fdr5uhha3986h2mthvfp7362nu\">qzs...2nu</a>, 1 (1%)\n2. <a href=\"https://explorer.e.cash/address/ecash:qr42c8c04tqndscfrdnl0rzterg0qdaegyjzt8egyg\">qr4...gyg</a>, 1 (1%)\n3. <a href=\"https://explorer.e.cash/address/ecash:qqvhatumna957qu0je78dnc9pc7c7hu89crkq6k0cd\">qqv...0cd</a>, 1 (1%)\n\n8 txs\n1 new Cashtab user claimed 42 free XEC\n1 Cashtab user claimed 100.00 CACHET\n1 CashFusion tx\n1 token tx\n1 app tx\n\nBinance Hot Wallet\n1 withdrawals totaling $1"
       ]
====== parse.js functions: summarizeTxHistory summarizes a collection of txs across multiple blocks without fiat price.parse.js functions summarizeTxHistory summarizes a collection of txs across multiple blocks without fiat price ======
AssertionError: Expected values to be loosely deep-equal:  [   '<b>74 blocks in 24 hours thru 14 Oct 2024, 07:00</b>\n' +     '\n' +     '3 miners found blocks\n' +     '<u>Top 3</u>\n' +     '1. Mining-Dutch, 1 (1%)\n' +     '2. solopool.org, 1 (1%)\n' +     '3. ViaBTC, 1 (1%)\n' +     '\n' +     '3 stakers earned 937,620 XEC\n' +     '<u>Top 3</u>\n' +     '1. <a href="https://explorer.e.cash/address/ecash:qzs8hq2pj4hu5j09fdr5uhha3986h2mthvfp7362nu">qzs...2nu</a>, 1 (1%)\n' +     '2. <a href="https://explorer.e.cash/address/ecash:qr42c8c04tqndscfrdnl0rzterg0qd...  should loosely deep-equal  [   '<b>74 blocks in 24 hours thru 14 Oct 2024, 00:00</b>\n' +     '\n' +     '3 miners found blocks\n' +     '<u>Top 3</u>\n' +     '1. Mining-Dutch, 1 (1%)\n' +     '2. solopool.org, 1 (1%)\n' +     '3. ViaBTC, 1 (1%)\n' +     '\n' +     '3 stakers earned 937,620 XEC\n' +     '<u>Top 3</u>\n' +     '1. <a href="https://explorer.e.cash/address/ecash:qzs8hq2pj4hu5j09fdr5uhha3986h2mthvfp7362nu">qzs...2nu</a>, 1 (1%)\n' +     '2. <a href="https://explorer.e.cash/address/ecash:qr42c8c04tqndscfrdnl0rzterg0qd...
AssertionError [ERR_ASSERTION]: Expected values to be loosely deep-equal:

[
  '<b>74 blocks in 24 hours thru 14 Oct 2024, 07:00</b>\n' +
    '\n' +
    '3 miners found blocks\n' +
    '<u>Top 3</u>\n' +
    '1. Mining-Dutch, 1 (1%)\n' +
    '2. solopool.org, 1 (1%)\n' +
    '3. ViaBTC, 1 (1%)\n' +
    '\n' +
    '3 stakers earned 937,620 XEC\n' +
    '<u>Top 3</u>\n' +
    '1. <a href="https://explorer.e.cash/address/ecash:qzs8hq2pj4hu5j09fdr5uhha3986h2mthvfp7362nu">qzs...2nu</a>, 1 (1%)\n' +
    '2. <a href="https://explorer.e.cash/address/ecash:qr42c8c04tqndscfrdnl0rzterg0qd...

should loosely deep-equal

[
  '<b>74 blocks in 24 hours thru 14 Oct 2024, 00:00</b>\n' +
    '\n' +
    '3 miners found blocks\n' +
    '<u>Top 3</u>\n' +
    '1. Mining-Dutch, 1 (1%)\n' +
    '2. solopool.org, 1 (1%)\n' +
    '3. ViaBTC, 1 (1%)\n' +
    '\n' +
    '3 stakers earned 937,620 XEC\n' +
    '<u>Top 3</u>\n' +
    '1. <a href="https://explorer.e.cash/address/ecash:qzs8hq2pj4hu5j09fdr5uhha3986h2mthvfp7362nu">qzs...2nu</a>, 1 (1%)\n' +
    '2. <a href="https://explorer.e.cash/address/ecash:qr42c8c04tqndscfrdnl0rzterg0qd...
    at Context.<anonymous> (test/parse.test.js:389:16)
    at process.processImmediate (node:internal/timers:483:21)

      + expected - actual

       [
      -  "<b>74 blocks in 24 hours thru 14 Oct 2024, 07:00</b>\n\n3 miners found blocks\n<u>Top 3</u>\n1. Mining-Dutch, 1 (1%)\n2. solopool.org, 1 (1%)\n3. ViaBTC, 1 (1%)\n\n3 stakers earned 937,620 XEC\n<u>Top 3</u>\n1. <a href=\"https://explorer.e.cash/address/ecash:qzs8hq2pj4hu5j09fdr5uhha3986h2mthvfp7362nu\">qzs...2nu</a>, 1 (1%)\n2. <a href=\"https://explorer.e.cash/address/ecash:qr42c8c04tqndscfrdnl0rzterg0qdaegyjzt8egyg\">qr4...gyg</a>, 1 (1%)\n3. <a href=\"https://explorer.e.cash/address/ecash:qqvhatumna957qu0je78dnc9pc7c7hu89crkq6k0cd\">qqv...0cd</a>, 1 (1%)\n\n8 txs\n1 new Cashtab user claimed 42 free XEC\n1 Cashtab user claimed 100.00 CACHET\n1 CashFusion tx\n1 token tx\n1 app tx\n\nBinance Hot Wallet\n1 withdrawals totaling 19,720 XEC"
      +  "<b>74 blocks in 24 hours thru 14 Oct 2024, 00:00</b>\n\n3 miners found blocks\n<u>Top 3</u>\n1. Mining-Dutch, 1 (1%)\n2. solopool.org, 1 (1%)\n3. ViaBTC, 1 (1%)\n\n3 stakers earned 937,620 XEC\n<u>Top 3</u>\n1. <a href=\"https://explorer.e.cash/address/ecash:qzs8hq2pj4hu5j09fdr5uhha3986h2mthvfp7362nu\">qzs...2nu</a>, 1 (1%)\n2. <a href=\"https://explorer.e.cash/address/ecash:qr42c8c04tqndscfrdnl0rzterg0qdaegyjzt8egyg\">qr4...gyg</a>, 1 (1%)\n3. <a href=\"https://explorer.e.cash/address/ecash:qqvhatumna957qu0je78dnc9pc7c7hu89crkq6k0cd\">qqv...0cd</a>, 1 (1%)\n\n8 txs\n1 new Cashtab user claimed 42 free XEC\n1 Cashtab user claimed 100.00 CACHET\n1 CashFusion tx\n1 token tx\n1 app tx\n\nBinance Hot Wallet\n1 withdrawals totaling 19,720 XEC"
       ]

Each failure log is accessible here:
parse.js functions: summarizeTxHistory summarizes a collection of txs across multiple blocks including fiat prices.parse.js functions summarizeTxHistory summarizes a collection of txs across multiple blocks including fiat prices
parse.js functions: summarizeTxHistory summarizes a collection of txs across multiple blocks without fiat price.parse.js functions summarizeTxHistory summarizes a collection of txs across multiple blocks without fiat price

bytesofman added inline comments.
apps/ecash-herald/src/parse.js
2437 ↗(On Diff #50129)

unrelated bug, in general still early days and cleaning up the function

2464 ↗(On Diff #50129)

unrelated bug, in general still early days and cleaning up the function

make sure events.js routine works, adjust input, tested running locally

emack requested changes to this revision.Oct 16 2024, 06:46
emack added a subscriber: emack.
emack added inline comments.
apps/ecash-herald/src/chronik.js
184 ↗(On Diff #50130)

isn't this invalidated once heartbeat upgrade goes in?

190–191 ↗(On Diff #50130)

since this is a guess and you only seem to be using the timestamp property further down, instead of hitting the API, can you just work out the timestamp by:

  1. chaintip subtracting guessedBlockheight
  2. apply the SECONDS_PER_BLOCK estimate to figure out how many ms since Date.now()
  3. use the above to calculate the current timestamp
This revision now requires changes to proceed.Oct 16 2024, 06:46
bytesofman marked 2 inline comments as done.
bytesofman added inline comments.
apps/ecash-herald/src/chronik.js
184 ↗(On Diff #50130)

this figure is only used for guessing

post heartbeat, 10 min per block is still the amount we should guess

190–191 ↗(On Diff #50130)

we don't want the current timestamp -- we already have this

we want to get all txs in the last 24 hrs

for now, chronik does not have the ability to look up txs by timestamp. So, we use the blockTxs to get all the txs over a desired time window

But, using blockTxs, we need to know which blocks will contain all txs in the given time window, in this case 24 hrs.

so, we getBlocksAgoFromChaintipByTimestamp to get the blocks. Then we use getAllBlockTxs over these blocks to get all the txs.

In this diff -- since we are using timeFirstSeen -- properly speaking perhaps we should also include unconfirmed txs. but imo this should wait for preconsensus; then we get all finalized txs in last 24 hrs.

This revision is now accepted and ready to land.Oct 17 2024, 11:38