Last active
September 4, 2018 06:04
-
-
Save yangyi/84a0477ad84bd3d7b591eb21321bd6f0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Insight-api使用的express框架对post请求有Body大小限制,默认为100kb,报错位置为:/bitcore/node_modules/raw-body/index.js, line196 | |
发送的post为json格式,根据调用轨迹express的body-parser模块对json格式的大小限制:/bitcore/node_modules/body-parser/lib/types/json.js, line54 | |
调用body-parser的是bitcore web service,现通过修改web service中的调用参数改为200kb: | |
bitcore/node_modules/bitcore-node/lib/services/web/index.js, line42 | |
整理了bitcore客户端大致结构: | |
启动bitcored后,读取bitcore-node.json配置文件,启动其中的各项service。 | |
通过log信息判断,p2p service会根据配置文件去连接一个指定的peer端口,此时如果已启动一个bitcoin node,p2p service就可以连接到这个node。如果配置文件没有指定端口,则会建立一个内置的bcoin node,bcoin是一个通过nodejs实现的bitcoin协议。 | |
Bcoin启动代码位置:/bitcore/node_modules/bitcore-node/lib/services/p2p/bcoin.js, line11 | |
同步到的数据存储路径为:/.bitcore/data/chain.ldb | |
insight-api通过block service等模块进行查询,block service依赖于db service,db service会从配置文件中读取数据库索引位置,代码位置为:/bitcore/node_modules/bitcore-node/lib/services/db/index, line82 | |
默认的datapath为:/.bitcore/data/bitcorenode.db | |
bitcorenode.db储存的不是一个full node的全部数据,根据db service的文档描述,这里面保存的应该是一个索引。目前还没搞清楚insight-api如何联系到真实的数据库。 | |
目前正在通过bitcore建立full node,数据尚未完全同步。过程中可以观察到chain.ldb目录大小增长,但是通过insight-api查询不到关于block的内容,调用/insight-api/sync也没有出现正在同步的信息。此时发送类似这种的查询:insight-api/block/xxxxxxxxxxx | |
报错信息为: | |
`block not in index` | |
从源码可以看出,insight-api在查询block hash时内置一个cache,在chache中查不到时再调用block service。block service会从bitcorenode.db中查找数据,而目前是查不到的。 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment