Commit Graph

12548 Commits

Author SHA1 Message Date
tomFlowee 0a1f0f8c52 Split 'API' tests into separate executables.
The test starts to become long to run and using the one main.cpp
hack we had removes our ability to select one test to run, so lets
go back to one executable per class.
2021-03-24 19:08:25 +01:00
tomFlowee 8124a65795 Peer reviewed: Blockchain::IncludeTxFees
Make plural.
2021-03-18 11:34:59 +01:00
tomFlowee 9d6ba33cc0 Add and test service to receive all double spend proofs. 2021-03-18 11:07:50 +01:00
tomFlowee d15a89dc99 Avoid duplication 2021-03-17 21:07:25 +01:00
tomFlowee 9025a2e2ea Add DoubleSpendService to listen to all double spend notifications 2021-03-16 19:53:14 +01:00
tomFlowee 7406cd6ecf Remove dead code (xor of stream). 2021-03-16 19:34:33 +01:00
tomFlowee 190de58f3e Add docs. 2021-03-16 18:56:28 +01:00
tomFlowee 0100c2f9e2 Wrap the services in one class
This allows us to avoid duplicating complexity in starting the API
subsystem.
2021-03-16 15:14:13 +01:00
tomFlowee fdd35c9e2c [REST] Implement address/details POST 2021-03-16 13:38:01 +01:00
tomFlowee 369fbd7b92 Don't trust inputs. 2021-03-15 12:55:24 +01:00
tomFlowee 9dada4c73e Separate tx validation and fees fetching.
For the txid/fee index we do a bit more than we can do for shallow block
validation.
Now we don't actually fully validate all transactions when this index is
enabled, we just fetch the fees.
2021-03-15 12:54:58 +01:00
tomFlowee 45dd785f39 Follow whole-script sizelimit.
Also add unit test for the op_return limits.
2021-03-13 16:52:04 +01:00
tomFlowee a9d3c2ee92 Support change to allow multiple op_returns 2021-03-13 14:02:38 +01:00
tomFlowee aa57e4bbb2 Merge branch 'blockMetadata' 2021-03-12 14:12:11 +01:00
tomFlowee e40b408c37 Put the writing of metadata in a try/catch
This solves issues with read-only blockchains.
As used by the unit test.
2021-03-12 14:08:55 +01:00
tomFlowee e9fd6384d5 Fix regression, and improve message
This again fetches the transaction data itself.
2021-03-12 14:08:16 +01:00
tomFlowee 5d750eb736 One less historical check needed so far after making them mandatory 2021-03-12 13:18:31 +01:00
tomFlowee 4e0acff905 Make reindex finding blocks massively faster.
The code that connects blocks together uses the block-hash (blockId) for
that, which we always just created on the fly.
Instead store the blockId on the state and in that way make adding
headers not entirely in-sequence be 10 times as fast.

Additionally, we wait with actual validation after a reindex until the
files are all found because otherwise we can't save the meta blocks.
2021-03-12 11:21:46 +01:00
tomFlowee ad7b81c17a Simplify and pick during reindex. 2021-03-12 10:28:27 +01:00
tomFlowee c73a9d850e Fix compiler warning. 2021-03-12 10:09:03 +01:00
tomFlowee e048ab1e2c Fix compiler warning. 2021-03-12 10:08:49 +01:00
tomFlowee bf5726eb58 Add scripting type on the block metadata 2021-03-12 10:08:31 +01:00
tomFlowee 6405ff2bad Finish up some metadata details. 2021-03-12 09:35:27 +01:00
tomFlowee bd5baa7133 Add ability to retrieve fees for a transaction.
This adds an option to the GetTransaction Flowee API to return the fees
for a whole transaction.
Support for this is added in the Blockchain (searcher) and the
RestService components.

Notice that no fees will be returned if the BlockMetaData was not
created properly.
2021-03-12 09:06:06 +01:00
tomFlowee 97e2ddbc87 Code meta-replacement tech
Make sure that if we validate a block again (reindex?), we don't create
a new meta object if a perfectly fine one already exists.
2021-03-11 10:22:45 +01:00
tomFlowee a7fd89c360 Make sure we record the lack of fee info. 2021-03-10 20:11:04 +01:00
tomFlowee 2a52ee3fe6 Use meta when available for finding tx.
This implements the getrawtransaction API/RPC calls to now use the meta
object, when available, for much faster finding of a transaction by txid.
2021-03-10 20:11:04 +01:00
tomFlowee 8a846d3a7b Add option -enableblockindex=true
this allows the user to ensure the metadata blocks fetch the previous
transaction in order to calculate the transaction-fee.
Normally this is skipped for transactions we don't need to do the script
validation for (old blocks).
2021-03-10 20:11:04 +01:00
tomFlowee b1daf37b43 Make reindex find the metadata blocks. 2021-03-10 20:11:04 +01:00
tomFlowee a4351c2f95 Write the meta block to disk. 2021-03-10 20:11:04 +01:00
tomFlowee 376a4ef9b5 Make block validation create a block metadata object.
This also changes the raw pointers to unique pointers for undo data.
2021-03-10 20:11:04 +01:00
tomFlowee 2395764bde Start new class BlockMetaData 2021-03-10 20:11:04 +01:00
tomFlowee 0cd6469efa Don't repeat default log section 2021-03-10 18:09:35 +01:00
tomFlowee 07c4922d71 Avoid copy 2021-03-10 18:09:32 +01:00
tomFlowee 51e671fefd Allow eliding by the compiler. 2021-03-08 13:48:33 +01:00
tomFlowee 78a01bb4b7 Take action on a static code checker finding an issue.
[code-quality]
We got a warning about a dereference of a nullptr. But that implied we
have an impossible combination of member variables.
So, lets assert on that being impossible so;
a) we get a fail-fast if this ever happens.
b) the static code checker will stop warning us.

Notice that asserts are compiled out of release executables. So this is
effectively a no-op for releases.
2021-03-08 13:48:30 +01:00
tomFlowee bc945ffaaf Remove silly code. 2021-03-08 13:48:20 +01:00
tomFlowee 018a855e03 Avoid confusion.
People all over the Internet, including on the BCH spec, seem confused
about these enum values. They think they are opcodes.
So lets be clear and rename them to the thing they are. Placeholders or
a return-code.
2021-03-06 14:50:40 +01:00
tomFlowee a2969b1e5d Fix compile with BENCHMARK define on. 2021-03-06 14:44:58 +01:00
tomFlowee b697a17168 Add 'validationOnly' option to API 2021-03-04 15:48:56 +01:00
tomFlowee 630b8422ed Upgrade RPC method to take a blockhash
This also moves the code to search linearly in a block onto the
FastBlock class, for reusal.
2021-03-03 10:17:14 +01:00
tomFlowee 07626a3f3e Fix loading an empty chain 2021-03-03 10:10:57 +01:00
tomFlowee d614c33d2a Add --keep option to prune to make a backup of the original files. 2021-02-28 22:16:05 +01:00
tomFlowee a222777c5a Minor fix: pass by reference. 2021-02-26 15:32:31 +01:00
tomFlowee 4d5e7bfb09 Protect node with user-limits for the API.
This introduces several options for public node operators to limit their
nodes usage by 3rd parties, this is aimed at usage of resource-hungry
areas.

We allow limiting the amount of connections any single IP can keep open
with us.
We limit the amount of reconnects we allow in a short number of seconds.
We allow limiting the number of addresses (or scriptHashes) a peer can
register for the node to scan.
The last one is for both the addressMonitorService as well as for the
getBlock filters.

For node operators these items become available using command line
options or config-file options. By default these limits are unlimited as
we assume default usage to be private.
2021-02-26 15:14:14 +01:00
tomFlowee 020c16c27a Put binding info in logfile. 2021-02-26 15:08:23 +01:00
tomFlowee 379e950cde Share code between projects
Move from the rest-server the method returnTemplatePath to the library
and reuse that in the bitcore-proxy client.
2021-02-23 17:55:26 +01:00
tomFlowee 048d5b83a8 make defaults more sane 2021-02-23 17:12:59 +01:00
tomFlowee 45df7c88e1 make pretty 2021-02-23 16:52:14 +01:00
tomFlowee cb245f27d7 Make pretty 2021-02-23 16:52:07 +01:00