Open osagga opened 6 years ago
[2018-06-22T03:52:14.175Z] error: Error: block not in index
at /bitcore-node/node_modules/insight-api/lib/blocks.js:79:41
at /bitcore-node/lib/services/block/index.js:471:14
at /bitcore-node/lib/services/db/index.js:107:16
at /bitcore-node/node_modules/levelup/lib/levelup.js:168:14
[2018-06-22T03:52:14.175Z] error: uncaught exception: Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client
at validateHeader (_http_outgoing.js:503:11)
at ServerResponse.setHeader (_http_outgoing.js:510:3)
at ServerResponse.header (/bitcore-node/node_modules/express/lib/response.js:767:10)
at ServerResponse.send (/bitcore-node/node_modules/express/lib/response.js:170:12)
at Common.handleErrors (/bitcore-node/node_modules/insight-api/lib/common.js:22:23)
at /bitcore-node/node_modules/insight-api/lib/blocks.js:79:28
at /bitcore-node/lib/services/block/index.js:471:14
at /bitcore-node/lib/services/db/index.js:107:16
at /bitcore-node/node_modules/levelup/lib/levelup.js:168:14
It seems that the node crashes because two Errors (Error [ERR_HTTP_HEADERS_SENT]
and Error: block not in index
) are raised at the same time, because when each error is raised individually, the node doesn't crash.
Update: this problem seems to happen when I look for any block index that is not in the database. When I try to look for an index 2010
(that's not in the blockchain):
[2018-06-22T04:07:28.170Z] error: Error: block not in index
at /bitcore-node/node_modules/insight-api/lib/blocks.js:79:41
at /bitcore-node/lib/services/block/index.js:123:14
at /bitcore-node/lib/services/block/index.js:491:16
at /bitcore-node/lib/services/header/index.js:617:14
at /bitcore-node/lib/services/db/index.js:107:16
at /bitcore-node/node_modules/levelup/lib/levelup.js:168:14
[2018-06-22T04:07:28.172Z] info: ::1 "GET /api/block/2010" 503 18 2.902 "PostmanRuntime/7.1.5"
[2018-06-22T04:07:28.172Z] error: Error: block not in index
at /bitcore-node/node_modules/insight-api/lib/blocks.js:79:41
at /bitcore-node/lib/services/block/index.js:471:14
at /bitcore-node/lib/services/db/index.js:107:16
at /bitcore-node/node_modules/levelup/lib/levelup.js:168:14
[2018-06-22T04:07:28.172Z] error: uncaught exception: Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client
at validateHeader (_http_outgoing.js:503:11)
at ServerResponse.setHeader (_http_outgoing.js:510:3)
at ServerResponse.header (/bitcore-node/node_modules/express/lib/response.js:767:10)
at ServerResponse.send (/bitcore-node/node_modules/express/lib/response.js:170:12)
at Common.handleErrors (/bitcore-node/node_modules/insight-api/lib/common.js:22:23)
at /bitcore-node/node_modules/insight-api/lib/blocks.js:79:28
at /bitcore-node/lib/services/block/index.js:471:14
at /bitcore-node/lib/services/db/index.js:107:16
at /bitcore-node/node_modules/levelup/lib/levelup.js:168:14
[2018-06-22T04:07:28.172Z] error: Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client
at validateHeader (_http_outgoing.js:503:11)
at ServerResponse.setHeader (_http_outgoing.js:510:3)
at ServerResponse.header (/bitcore-node/node_modules/express/lib/response.js:767:10)
at ServerResponse.send (/bitcore-node/node_modules/express/lib/response.js:170:12)
at Common.handleErrors (/bitcore-node/node_modules/insight-api/lib/common.js:22:23)
at /bitcore-node/node_modules/insight-api/lib/blocks.js:79:28
at /bitcore-node/lib/services/block/index.js:471:14
at /bitcore-node/lib/services/db/index.js:107:16
at /bitcore-node/node_modules/levelup/lib/levelup.js:168:14
[2018-06-22T04:07:28.173Z] info: Beginning shutdown
[2018-06-22T04:07:28.173Z] info: P2P Service: disconnecting pool and peers. SIGINT issued, system shutdown initiated
[2018-06-22T04:07:28.173Z] info: Disconnected from peer: 127.0.0.1
[2018-06-22T04:07:28.173Z] warn: Node is stopping, gently closing the database. Please wait, this could take a while.
[2018-06-22T04:07:28.174Z] info: Stopping insight-ui
[2018-06-22T04:07:28.174Z] info: Stopping insight-api
[2018-06-22T04:07:28.174Z] info: Stopping web
[2018-06-22T04:07:28.174Z] info: Stopping fee
[2018-06-22T04:07:28.174Z] info: Stopping address
[2018-06-22T04:07:28.174Z] info: Stopping transaction
[2018-06-22T04:07:28.174Z] info: Stopping block
[2018-06-22T04:07:28.174Z] info: Stopping mempool
[2018-06-22T04:07:28.174Z] info: Stopping timestamp
[2018-06-22T04:07:28.175Z] info: Stopping header
[2018-06-22T04:07:28.175Z] info: Stopping db
[2018-06-22T04:07:28.175Z] info: Stopping p2p
Accessing block
0
(the Gensis block) by its hash raises a 'block not in index' as follows:Also passing '0' into the search box crashes the
bitcore-node
as follows:It's probably a problem in the source code regrading handling the first block. I'll keep looking into it.