uaktags / explorer

An open source block explorer
BSD 3-Clause "New" or "Revised" License
6 stars 8 forks source link

tx not found #8

Closed ElpidioMC closed 5 years ago

ElpidioMC commented 5 years ago

Hello, i'm testing your block explorer, but i have a error when i try to reindex de blockchaing:

node scripts/sync.js index reindex
script launched with pid: 29194
(node:29194) DeprecationWarning: collection.ensureIndex is deprecated. Use createIndexes instead.
Update Stats Completed.
(node:29194) DeprecationWarning: collection.remove is deprecated. Use deleteOne, deleteMany, or bulkWrite instead.
(node:29194) DeprecationWarning: collection.update is deprecated. Use updateOne, updateMany, or bulkWrite instead.
index cleared (reindex)
tx not found: af4517dedb668073063d28d8aafe22fe19f60ecd73ba378c3beb229d67c9739f
tx not found: faddb01584632c5f39807fad76727b3ebd1786f57f57724ce219a2d9648e21bf
tx not found: de12c8b2678aa5ffb7b728042cfb7b9479c9d9569097d1ba3849bf64874e4504
tx not found: 95fb58dba4aa7c03a58a200070b869be3cc5564a2c30db1c890303a4200616b0
tx not found: 9ae391289c3c7de6af4b86ced783ba45b92763242c6cd7ad9a4150cb3effea2a

npm = 6.4.1 node = 8.16.0 blackchain = ArepaCoin

uaktags commented 5 years ago

Trying to test this but I can't get the conf to actually load for the wallet. Also, check that your wallet's console can see that tx. Here's what I get

13:47:39   getrawtransaction "af4517dedb668073063d28d8aafe22fe19f60ecd73ba378c3beb229d67c9739f" 13:47:39   No information available about transaction (code -5)
uaktags commented 5 years ago
node .\scripts\sync.js index reindex
script launched with pid: 1532
(node:1532) DeprecationWarning: collection.ensureIndex is deprecated. Use createIndexes instead.
Update Stats Completed.
(node:1532) DeprecationWarning: collection.remove is deprecated. Use deleteOne, deleteMany, or bulkWrite instead.
(node:1532) DeprecationWarning: collection.update is deprecated. Use updateOne, updateMany, or bulkWrite instead.
Start:  1 End: 5
Current: 1
index cleared (reindex)
Got Blockhash: 000001014d95e38e38d7ce26c39504596bca8d47c4f69c1fa78a437cd995274c. Current again: 1
Block:  { hash: '000001014d95e38e38d7ce26c39504596bca8d47c4f69c1fa78a437cd995274c',
  confirmations: 1103731,
  size: 174,
  height: 1,
  version: 6,
  merkleroot: 'af4517dedb668073063d28d8aafe22fe19f60ecd73ba378c3beb229d67c9739f',
  mint: 325,
  time: 1515629025,
  nonce: 809500672,
  bits: '1e0fffff',
  difficulty: 0.00024414,
  blocktrust: '100001',
  chaintrust: '200002',
  previousblockhash: '000002cac270a01e29300abaaeb7d412ca00fa7f43f0d547a57b9ff9c85d95e8',
  nextblockhash: '00000008ed081eecf0a5222ffd905a2b2a9dff607199394fad7824a958dadafe',
  flags: 'proof-of-work',
  proofhash: '000001014d95e38e38d7ce26c39504596bca8d47c4f69c1fa78a437cd995274c',
  entropybit: 0,
  modifier: '0000000000000000',
  modifierchecksum: '2dcbe358',
  tx:
   [ 'af4517dedb668073063d28d8aafe22fe19f60ecd73ba378c3beb229d67c9739f' ] }
Error  tx not found: af4517dedb668073063d28d8aafe22fe19f60ecd73ba378c3beb229d67c9739f
Current: 2
Got Blockhash: 00000008ed081eecf0a5222ffd905a2b2a9dff607199394fad7824a958dadafe. Current again: 2
Block:  { hash: '00000008ed081eecf0a5222ffd905a2b2a9dff607199394fad7824a958dadafe',
  confirmations: 1103736,
  size: 174,
  height: 2,
  version: 6,
  merkleroot: 'faddb01584632c5f39807fad76727b3ebd1786f57f57724ce219a2d9648e21bf',
  mint: 325,
  time: 1515629194,
  nonce: 3375431680,
  bits: '1e0fffff',
  difficulty: 0.00024414,
  blocktrust: '100001',
  chaintrust: '300003',
  previousblockhash: '000001014d95e38e38d7ce26c39504596bca8d47c4f69c1fa78a437cd995274c',
  nextblockhash: '0000064f5a5939bf987497c347cc237c6e1a811a0967c0bde0ae583aa3f8a098',
  flags: 'proof-of-work stake-modifier',
  proofhash: '00000008ed081eecf0a5222ffd905a2b2a9dff607199394fad7824a958dadafe',
  entropybit: 0,
  modifier: '0000000000000000',
  modifierchecksum: '4da80b60',
  tx:
   [ 'faddb01584632c5f39807fad76727b3ebd1786f57f57724ce219a2d9648e21bf' ] }
Error  tx not found: faddb01584632c5f39807fad76727b3ebd1786f57f57724ce219a2d9648e21bf
Current: 3
Got Blockhash: 0000064f5a5939bf987497c347cc237c6e1a811a0967c0bde0ae583aa3f8a098. Current again: 3
Block:  { hash: '0000064f5a5939bf987497c347cc237c6e1a811a0967c0bde0ae583aa3f8a098',
  confirmations: 1103754,
  size: 174,
  height: 3,
  version: 6,
  merkleroot: 'de12c8b2678aa5ffb7b728042cfb7b9479c9d9569097d1ba3849bf64874e4504',
  mint: 325,
  time: 1515629216,
  nonce: 4030857216,
  bits: '1e0fffff',
  difficulty: 0.00024414,
  blocktrust: '100001',
  chaintrust: '400004',
  previousblockhash: '00000008ed081eecf0a5222ffd905a2b2a9dff607199394fad7824a958dadafe',
  nextblockhash: '0000044ef39962909e7405f7df09bd2faefb8c566b5728a6b6b4ad7fa9c88700',
  flags: 'proof-of-work',
  proofhash: '0000064f5a5939bf987497c347cc237c6e1a811a0967c0bde0ae583aa3f8a098',
  entropybit: 0,
  modifier: '0000000000000000',
  modifierchecksum: 'cbb7b6e8',
  tx:
   [ 'de12c8b2678aa5ffb7b728042cfb7b9479c9d9569097d1ba3849bf64874e4504' ] }
Error  tx not found: de12c8b2678aa5ffb7b728042cfb7b9479c9d9569097d1ba3849bf64874e4504
Current: 4
Got Blockhash: 0000044ef39962909e7405f7df09bd2faefb8c566b5728a6b6b4ad7fa9c88700. Current again: 4
Block:  { hash: '0000044ef39962909e7405f7df09bd2faefb8c566b5728a6b6b4ad7fa9c88700',
  confirmations: 1103777,
  size: 174,
  height: 4,
  version: 6,
  merkleroot: '95fb58dba4aa7c03a58a200070b869be3cc5564a2c30db1c890303a4200616b0',
  mint: 325,
  time: 1515629316,
  nonce: 3124559872,
  bits: '1e0ececd',
  difficulty: 0.00026379,
  blocktrust: '1149c5',
  chaintrust: '5149c9',
  previousblockhash: '0000064f5a5939bf987497c347cc237c6e1a811a0967c0bde0ae583aa3f8a098',
  nextblockhash: '0000010cb2d88ef43280d25be21b2a4531959593e03bacf445b2775b59d20ad6',
  flags: 'proof-of-work',
  proofhash: '0000044ef39962909e7405f7df09bd2faefb8c566b5728a6b6b4ad7fa9c88700',
  entropybit: 0,
  modifier: '0000000000000000',
  modifierchecksum: 'befa7364',
  tx:
   [ '95fb58dba4aa7c03a58a200070b869be3cc5564a2c30db1c890303a4200616b0' ] }
GET /api/getblockhash?height=1 200 102.262 ms - 66
GET /api/getblockhash?height=1103723 200 76.522 ms - 66
GET /api/getblock?hash=000001014d95e38e38d7ce26c39504596bca8d47c4f69c1fa78a437cd995274c 200 123.430 ms - 768
GET /api/getblock?hash=74cf25d88be8855a51f3344e08fa2c0b2292428faf01786c9cdd0f62dd1a8cd0 200 125.685 ms - 1000
GET /api/getblockhash?height=1103722 200 244.690 ms - 66
{ name: 'SyntaxError',
  message: 'Duplicate key "time"',
  at: 717,
  text: '[{"result":{"hex":"010000000fa8565a010000000000000000000000000000000000000000000000000000000000000000ffffffff03510142ffffffff0100a52691070000001976a91414b2f81cbf79147c839cd5f6623815fdc3b1320888ac00000000","txid":"af4517dedb668073063d28d8aafe22fe19f60ecd73ba378c3beb229d67c9739f","version":1,"time":1515628559,"locktime":0,"vin":[{"coinbase":"510142","sequence":4294967295}],"vout":[{"value":325.00000000,"n":0,"scriptPubKey":{"asm":"OP_DUP OP_HASH160 14b2f81cbf79147c839cd5f6623815fdc3b13208 OP_EQUALVERIFY OP_CHECKSIG","reqSigs":1,"type":"pubkeyhash","addresses":["AHfKZLDer8LY1ecASqzCZy5d9YzGtGBGiA"]}}],"blockhash":"000001014d95e38e38d7ce26c39504596bca8d47c4f69c1fa78a437cd995274c","confirmations":1103733,"time":1515629025,"blocktime":1515629025},"error":null,"id":"1556476505549-0"}]\n' }
GET /api/getrawtransaction?txid=af4517dedb668073063d28d8aafe22fe19f60ecd73ba378c3beb229d67c9739f&decrypt=1 200 247.045 ms - 39
GET /api/getblock?hash=06971c1dd5d78f428876b9b9224134cb73381d6c53471b6fa999c8075e7878e2 200 390.445 ms - 1001
GET /api/getblockhash?height=2 200 378.891 ms - 66
GET /api/getblockhash?height=1103721 200 128.950 ms - 66
GET /api/getblock?hash=00000008ed081eecf0a5222ffd905a2b2a9dff607199394fad7824a958dadafe 200 132.781 ms - 784
{ name: 'SyntaxError',
  message: 'Duplicate key "time"',
  at: 717,
  text: '[{"result":{"hex":"01000000e9a9565a010000000000000000000000000000000000000000000000000000000000000000ffffffff03520116ffffffff0100a52691070000001976a91414b2f81cbf79147c839cd5f6623815fdc3b1320888ac00000000","txid":"faddb01584632c5f39807fad76727b3ebd1786f57f57724ce219a2d9648e21bf","version":1,"time":1515629033,"locktime":0,"vin":[{"coinbase":"520116","sequence":4294967295}],"vout":[{"value":325.00000000,"n":0,"scriptPubKey":{"asm":"OP_DUP OP_HASH160 14b2f81cbf79147c839cd5f6623815fdc3b13208 OP_EQUALVERIFY OP_CHECKSIG","reqSigs":1,"type":"pubkeyhash","addresses":["AHfKZLDer8LY1ecASqzCZy5d9YzGtGBGiA"]}}],"blockhash":"00000008ed081eecf0a5222ffd905a2b2a9dff607199394fad7824a958dadafe","confirmations":1103738,"time":1515629194,"blocktime":1515629194},"error":null,"id":"1556476506338-0"}]\n' }
GET /api/getrawtransaction?txid=faddb01584632c5f39807fad76727b3ebd1786f57f57724ce219a2d9648e21bf&decrypt=1 200 251.371 ms - 39
GET /api/getblock?hash=00000000037dcc1e90ba6356b7703a4afec80bdddb5e5ea44617707c6c413ad3 200 268.477 ms - 781
GET /api/getblockhash?height=3 200 1521.133 ms - 66
GET /api/getblockhash?height=1103720 200 1535.434 ms - 66
GET /api/getblock?hash=0000000001f8f14a42975fada2af8794b6b2a1b7c6bef4941478a600bc997885 200 636.899 ms - 782
GET /api/getblock?hash=0000064f5a5939bf987497c347cc237c6e1a811a0967c0bde0ae583aa3f8a098 200 637.010 ms - 769
GET /api/getblockhash?height=1103719 200 376.863 ms - 66
{ name: 'SyntaxError',
  message: 'Duplicate key "time"',
  at: 717,
  text: '[{"result":{"hex":"0100000091aa565a010000000000000000000000000000000000000000000000000000000000000000ffffffff03530103ffffffff0100a52691070000001976a91414b2f81cbf79147c839cd5f6623815fdc3b1320888ac00000000","txid":"de12c8b2678aa5ffb7b728042cfb7b9479c9d9569097d1ba3849bf64874e4504","version":1,"time":1515629201,"locktime":0,"vin":[{"coinbase":"530103","sequence":4294967295}],"vout":[{"value":325.00000000,"n":0,"scriptPubKey":{"asm":"OP_DUP OP_HASH160 14b2f81cbf79147c839cd5f6623815fdc3b13208 OP_EQUALVERIFY OP_CHECKSIG","reqSigs":1,"type":"pubkeyhash","addresses":["AHfKZLDer8LY1ecASqzCZy5d9YzGtGBGiA"]}}],"blockhash":"0000064f5a5939bf987497c347cc237c6e1a811a0967c0bde0ae583aa3f8a098","confirmations":1103757,"time":1515629216,"blocktime":1515629216},"error":null,"id":"1556476508780-0"}]\n' }
GET /api/getrawtransaction?txid=de12c8b2678aa5ffb7b728042cfb7b9479c9d9569097d1ba3849bf64874e4504&decrypt=1 200 379.141 ms - 39
GET /api/getblockhash?height=4 200 1785.473 ms - 66
GET /api/getblock?hash=2a2365981980f3a4d671ccf3f2f136b1342a443942b2e6574f29a110657b6d61 200 1803.346 ms - 1003
GET /api/getblockhash?height=1103718 200 877.672 ms - 66
GET /api/getblock?hash=0000044ef39962909e7405f7df09bd2faefb8c566b5728a6b6b4ad7fa9c88700 200 880.692 ms - 769
GET /api/getblock?hash=000000000149d37e841ef6502075c09ce0bbe9f3c4eefd01b717bdad3afdd2b7 - - ms - -
GET /api/getrawtransaction?txid=95fb58dba4aa7c03a58a200070b869be3cc5564a2c30db1c890303a4200616b0&decrypt=1 - - ms - -
{ name: 'SyntaxError',
  message: 'Duplicate key "time"',
  at: 717,
  text: '[{"result":{"hex":"01000000a8aa565a010000000000000000000000000000000000000000000000000000000000000000ffffffff0354010effffffff0100a52691070000001976a91414b2f81cbf79147c839cd5f6623815fdc3b1320888ac00000000","txid":"95fb58dba4aa7c03a58a200070b869be3cc5564a2c30db1c890303a4200616b0","version":1,"time":1515629224,"locktime":0,"vin":[{"coinbase":"54010e","sequence":4294967295}],"vout":[{"value":325.00000000,"n":0,"scriptPubKey":{"asm":"OP_DUP OP_HASH160 14b2f81cbf79147c839cd5f6623815fdc3b13208 OP_EQUALVERIFY OP_CHECKSIG","reqSigs":1,"type":"pubkeyhash","addresses":["AHfKZLDer8LY1ecASqzCZy5d9YzGtGBGiA"]}}],"blockhash":"0000044ef39962909e7405f7df09bd2faefb8c566b5728a6b6b4ad7fa9c88700","confirmations":1103793,"time":1515629316,"blocktime":1515629316},"error":null,"id":"1556476511856-0"}]\n' }
uaktags commented 5 years ago

Are you seeing much the same as well?

uaktags commented 5 years ago

Unfortunately, this is a problem with your coin's wallet

that duplicate key "time" is causing the json to break. This all ties into bitcoin-core using nodejs' request and JSON.stringify. You can see this yourself using your wallet's console. I don't know why there's two times, but it appears that the second one is redundant from blocktime

getrawtransaction de12c8b2678aa5ffb7b728042cfb7b9479c9d9569097d1ba3849bf64874e4504 1
{
"hex" : "0100000091aa565a010000000000000000000000000000000000000000000000000000000000000000ffffffff03530103ffffffff0100a52691070000001976a91414b2f81cbf79147c839cd5f6623815fdc3b1320888ac00000000",
"txid" : "de12c8b2678aa5ffb7b728042cfb7b9479c9d9569097d1ba3849bf64874e4504",
"version" : 1,
"time" : 1515629201, <=========
"locktime" : 0,
"vin" : [
{
"coinbase" : "530103",
"sequence" : 4294967295
}
],
"vout" : [
{
"value" : 325.00000000,
"n" : 0,
"scriptPubKey" : {
"asm" : "OP_DUP OP_HASH160 14b2f81cbf79147c839cd5f6623815fdc3b13208 OP_EQUALVERIFY OP_CHECKSIG",
"reqSigs" : 1,
"type" : "pubkeyhash",
"addresses" : [
"AHfKZLDer8LY1ecASqzCZy5d9YzGtGBGiA"
]
}
}
],
"blockhash" : "0000064f5a5939bf987497c347cc237c6e1a811a0967c0bde0ae583aa3f8a098",
"confirmations" : 1152813,
"time" : 1515629216,  <========
"blocktime" : 1515629216
}
ElpidioMC commented 5 years ago

In my wallet I get this result:

./arepacoind getblockhash 1
000001014d95e38e38d7ce26c39504596bca8d47c4f69c1fa78a437cd995274c
./arepacoind getblock 000001014d95e38e38d7ce26c39504596bca8d47c4f69c1fa78a437cd995274c
{
    "hash" : "000001014d95e38e38d7ce26c39504596bca8d47c4f69c1fa78a437cd995274c",
    "confirmations" : 1152819,
    "size" : 174,
    "height" : 1,
    "version" : 6,
    "merkleroot" : "af4517dedb668073063d28d8aafe22fe19f60ecd73ba378c3beb229d67c9739f",
    "mint" : 325.00000000,
    "time" : 1515629025,
    "nonce" : 809500672,
    "bits" : "1e0fffff",
    "difficulty" : 0.00024414,
    "blocktrust" : "100001",
    "chaintrust" : "200002",
    "previousblockhash" : "000002cac270a01e29300abaaeb7d412ca00fa7f43f0d547a57b9ff9c85d95e8",
    "nextblockhash" : "00000008ed081eecf0a5222ffd905a2b2a9dff607199394fad7824a958dadafe",
    "flags" : "proof-of-work",
    "proofhash" : "000001014d95e38e38d7ce26c39504596bca8d47c4f69c1fa78a437cd995274c",
    "entropybit" : 0,
    "modifier" : "0000000000000000",
    "modifierchecksum" : "2dcbe358",
    "tx" : [
        "af4517dedb668073063d28d8aafe22fe19f60ecd73ba378c3beb229d67c9739f"
    ]
}
./arepacoind getrawtransaction af4517dedb668073063d28d8aafe22fe19f60ecd73ba378c3beb229d67c9739f
010000000fa8565a010000000000000000000000000000000000000000000000000000000000000000ffffffff03510142ffffffff0100a52691070000001976a91414b2f81cbf79147c839cd5f6623815fdc3b1320888ac00000000

but:

{ name: 'SyntaxError',
  message: 'Duplicate key "time"',

So that means that the error is in that my wallet shows twice data for the time?

ElpidioMC commented 5 years ago

I understand, thanks for your answer friend.

uaktags commented 5 years ago

Correct, decrypt the rawtransaction and you'll see the double time

ElpidioMC commented 5 years ago

Thanks you, i fix the problem with the wallet, but now i can't update db:

explorer/lib/explorer.js:384
    module.exports.syncLoop(tx.vin.length, function (loop) {
                                   ^

TypeError: Cannot read property 'length' of undefined
    at Object.prepare_vin (/root/explorer/lib/explorer.js:384:36)
    at /root/explorer/lib/database.js:162:15
    at Request._callback (/root/explorer/lib/explorer.js:122:14)
    at Request.self.callback (/root/explorer/node_modules/request/request.js:185:22)
    at emitTwo (events.js:126:13)
    at Request.emit (events.js:214:7)
    at Request.<anonymous> (/root/explorer/node_modules/request/request.js:1161:10)
    at emitOne (events.js:116:13)
    at Request.emit (events.js:211:7)
    at IncomingMessage.<anonymous> (/root/explorer/node_modules/request/request.js:1083:12)
    at Object.onceWrapper (events.js:313:30)
    at emitNone (events.js:111:20)
    at IncomingMessage.emit (events.js:208:7)
    at endReadableNT (_stream_readable.js:1064:12)
    at _combinedTickCallback (internal/process/next_tick.js:139:11)
    at process._tickCallback (internal/process/next_tick.js:181:9)

I know you're working on that, I appreciate all your work.