v0.7.0 - Growing Up
NOTE: There are important steps to follow when upgrading. See Upgrading below for details
SUPER IMPORTANT NOTE: An important bug fix is in v0.7.1 -- please use that instead.
Highlights
Since the previous tagged release, there have been extensive changes. The highlights are:
- WebSocket server with support for live updates.
- New API endpoints: address, transactions, block by hash, block size and transaction info, custom step in block range request, and more.
- Improved reorganization handling by dcrsqlite and blockdata, on top of previous work on stakedb handling.
- Improved synchronization of collection routines.
There are tons of other improvements and fixes. A more detailed list is in Changes below, but see the commit messages and code diff (v0.3.2...v0.7.0) for the gory details.
Upgrading
Delete the databases to force a resync: rm -r ffldb_stake dcrdata.sqlt.db
then start dcrdata
.
If you are upgrading from source, you must refresh the vendor folder after pulling changes from git:
# first checkout and pull latest master
# refresh vendor:
rm -rf vendor/
glide install
# proceed to build/install as usual
Acknowledgements
Thanks to the following people for their contributions: @gozart1, @RogueElement, @raedah.
Changes
- Use RealIP middleware to log actual client IP when behind reverse proxy.
- Switch to new logger (btclog+jrick's logrotate).
- Add CollectBlockInfo to get by hash most data.
- Remove
poolinfo
config option. - Give stakedb.PoolInfo() a second output, the height of the stake node.
- Switch chi import path, update to chi 3.0.
- Enable CORS for /api
- Update all depends with glide
- Reorg handling for dcrsqlite.
- Create (*Collector).CollectAPITypes to get the apitypes.BlockDataBasic and apitypes.StakeInfoExtended needed to update blocks in sqlite during reorg.
- Remove problematic mempool trigger, and make limits more sensitive. There was a collection condition if num tickets in mempool was still less than max fresh stake. This was silly. Remove this condition.
- Set the mempool new ticket count trigger default to 1, and the min interval to 2 sec.
- Fixed nodaemontls value (pull request #64 from RogueElement/notls)
- API - Stream and compress block range response
- WebSocket support. This adds WebSocket connection handling to the web interface, on /ws. There are three events:
- Block data. More than just data from the block, but it contains information obtained following the latest block.
- Mempool updates. Potentially send much more frequently than block updates.
- Ping.
- API - Block verbose and block-by-hash
- Add getBlockHashSQL, getBlockHeightSQL queries to sqlite.go
- Add RetrieveBestBlockHash and RetrieveBestBlockHeight to Sqlite
- API - Add endpoints: /api/block/hash/{blockhash}/...
- API - Add .../hash to the routers on: /api/block/best and /api/block/{idx}.
- Add GetBlockVerboseByHash to rpcutils package.
- API - Add transactions-for-block via .../tx endpoints, and apitypes.BlockTransactions.
- API - Add block size endpoints, like /block/.../size. This includes range, where an array of integers is returned.
- A new SQLite query is added to make block size lookup fast. Only the size column is returned.
- API - Transaction Endpoints:
- /tx/{txid}. Returns apitypes.Tx. Uses one getrawtransaction call to node.
- Add /tx/{txid}/[in|out], new types.
- Add /tx/{txid}/[in|out]/{txinoutindex} to get a specific input or output. This is outpoint -> output lookup, and similarly for input.
- Fix crash on missing config file (merge PR 76 from RogueElement)
- API - Added transaction count for block: /api/block/[{id}|{hash}]/tx/count
- Mempool TxHandler efficiency. Include Tx acquire time in mempool event handler. Make sure time since acquire is less than time since lass collect, otherwise we've already collected it via the previous event. log already collected tx only if it would have been collected
- Tweak web ui.
- Add sample nginx.conf and rate_limiting.html
- API - Step param in block range requests
- Change default APIListen to 127.0.0.1:7777
- Do not continue startup if stake DB is already opened (unavailable).
- API - added Address endpoint
- Make a collectionQueue to run certain collection/storage functions in order and synchronously
- Create blockdata.(*Collector).CollectHash(*chainhash.Hash) to be used in the event that the chain node best block is higher than the block requested for data collection. Pool value may be wrong if the stake DB is not on the same height however. But the new synchronous execution changes are indended to prevent the stake DB from getting ahead. Update blockdata.(*chainMonitor).BlockConnectedHandler so that it will call Collect() only if chain height equals the height of the requested block data, and call CollectHash(hash) if collection is behind. A caveat with CollectHash, in addition to the pool value bit described above, is that it will not get the next block window estimates, however this is not needed if a higher block is waiting to be processed subsequently.
- Create PoolInfoCache, and collect pool info for each block that is connected in stakedb.
- rename daemonLog -> blockdataLog, DCRD -> BLKD
- Enable blockdata's reorg handler to collect update web UI only on last block of new main chain. Add a special BlockDataSaver slice just for use in a reorg, so as not to run the sqlite saver twice. dcrsqlite handles the reorg itself. Turn trace logging back to info in blockdata.
- Signal mempool collector that a new block was mined via a nil Hash, sent from (*collectionQueue).ProcessBlocks(). Update (*mempoolMonitor).TxHandler to recognize the signal and skip transaction checking and other irrelevant logic. Refactor collection and storage code into (*mempoolMonitor) CollectAndStore() for reuse.
- API - remove /directory (still have /list)