Querying addresses that have millions of transactions is supported however
takes hundreds of seconds to fully calculate the balance. Creating a cache of
previous results wasn't currently working because the `isSpent` query is always
based on the current bitcoind tip. Thus the balance of the outputs would be included
however wouldn't be removed when spent as the output wouldn't be checked again
when querying for blocks past the last checkpoint. Including the satoshis in the
inputs address index would make it possible to subtract the spent amount,
however this degrades optimizations elsewhere. The syncing times or querying
for addresses with 10,000 transactions per address.
It may preferrable to have an additional address service that handles high-volume
addresses be on an opt-in basis so that a custom running client could select
high volume addresses to create optimizations for querying balances and history.
The strategies for creating indexes differs on these use cases.
- Adds parameter to cli methods to be able to specify the location of services modules. This is useful for packages that wrap bitcore-node to be able to pass along a node_modules directory with services.
- Adds another parameter for including additional services in the default settings.
- Will use the `process.env.HOME + '/.bitcore` as the default configuration location.
- There are now two `getDefaultConfig`, one that will instatiate a `~/.bitcore` directory with a default if it doesn't exist, and `getBaseDefaultConfig` that will return a basic configuration without additional services enabled.
- Changes logic to use the global install if a local node_modules version is not available, this would previously assume that it was a local install because of the existence of a configuration file.
The address history `combineTransactionInfo` method removes the
outputIndex when creating the outputIndexes property. When these are
from the mempool the original reference is also modified.
We can easily solve this by returning new instances in `getOutputs`
and `getInputs` instead of a reference to the actual mempool instance.
This will also have the additional benefit that height and other
properties that will be the same for every mempool entry will
not be stored in memory longer than what is necessary to fulfill
a request.
There was a bug when getting unspent outputs that would include an output
that was spent in the mempool in addition to the new output with the change
address. This lead to a balance having an output counted twice towards the
end balance. The solution is to have the isSpent method for the address service
to also include if the output was spent in the mempool, as the isSpent
method exposed from bitcoind only includes if the output was spent in a block.
- To be able to query an inputTxId and inputIndex that spends an outputTxId and outputIndex
- Extends the mempoolSpentIndex to include the inputTxId and inputIndex
- Introduced the concept of a Cancellation error so that services can choose to watch for a cancellation flag.
- Services can then send this error back and it will be forwarded to the node.
- The node will then know to call shutdown appropriately.
- Added the concept of loadServices on the node so that the node can conditionally call stop on loadingServices
- This serves the case where services might be loading versus fully loaded (which is not always the cases for heavy services like bitcoind)
- Sort and paginate before getting full transaction details.
- Only get detailed transaction information for items within the current page.
- Improves the performance with large sets of transactions.
- Reindexing the bitcore-node database is required with this change.
- Address indexes are updated to include address and height in spent index so that both inputs and outputs can be queried by address and height using "start" and "stop" to limit the range of the query.
- Address history also now supports paginated results using "from" and "to" values that indicate an index in the array.
- Added a simple replacement function after the first sigint is handled.
- Added unit tests for the exitHandler, requiring it to be exposed from the module.