Commit Graph

236 Commits

Author SHA1 Message Date
tomFlowee d797b1bf50 Minor additions of helper methods.
Tested in the upcoming unit test.
2021-03-24 21:00:25 +01:00
tomFlowee 41e0739e17 add op_group convenience method to transactionbuilder 2021-03-24 19:08: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 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 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 c73a9d850e Fix compiler warning. 2021-03-12 10:09:03 +01:00
tomFlowee 51e671fefd Allow eliding by the compiler. 2021-03-08 13:48:33 +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 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 048d5b83a8 make defaults more sane 2021-02-23 17:12:59 +01:00
tomFlowee bf88ee6218 Check inputs better 2021-02-16 19:22:33 +01:00
tomFlowee 08c04b3b25 Assume less and check the inputs better
Should an Tx::Iterator be created on some random data we are now
checking the read values better.
2021-02-16 18:56:13 +01:00
tomFlowee b4df28bd90 Avoid programming errors, add assert. 2021-02-11 15:23:35 +01:00
tomFlowee 1f2f7c36d2 Port the boost container to the std one.
The unordered_map is now available in stl, and said to be better,
so lets slowly switch over
2021-02-03 16:31:46 +01:00
tomFlowee 94ae61132b Promote 'interpreter' to the utils lib.
Being able to parse bitcoin-script is useful for users other than
the hub, using the flowee shared libraries they can now do so.
2021-01-21 15:47:46 +01:00
tomFlowee 7b0949031f Rename CHashWriter::GetHash to finalizeHash()
as the expected behavior of 'get*' is a const method, it is harmful to
name a method such when it actually alters the state of the method such
that subsequent calls will produce a different result.
2021-01-20 22:51:48 +01:00
tomFlowee 449dc47871 Move CReserveScript to the only user: the wallet
This does remove the feature that mining can use the internal wallet as
a source of coinbase addresses, but since Flowee doesn't actually ship a
wallet, that was just not a good reason to keep an unused class in the
libs.
2021-01-20 22:43:37 +01:00
tomFlowee 235df9c5f0 Add loading of DSProof from a constbuffer. 2021-01-20 21:35:20 +01:00
tomFlowee 40b6e4e02c Prefer modern C++
static const -> constexpr
2021-01-20 19:59:54 +01:00
tomFlowee defd3950f0 Remove CAmount typedef
The CAmount name is not helpful as its just an int64_t and not a
class, like the name implies. There were a handful of places where
it was passed in as const-ref, as a good example of this actually
creating sub-par code.
2021-01-20 19:59:35 +01:00
tomFlowee b12e846c92 whitespace, make pretty 2021-01-20 19:14:53 +01:00
tomFlowee 5b7fa33573 Add an extra assert.
The method offsetInBlock assumes the block actually is the one this
transaction is in, the assert helps making sure that this assumption
isn't broken, prodicing unusable results.
2021-01-20 18:23:59 +01:00
tomFlowee e1d57f91ba Specify copy-construtor and asssignment operators
To be explicit avoids confusion.
2021-01-20 16:00:25 +01:00
tomFlowee 371a9c5151 Remove unused type 2021-01-13 11:39:38 +01:00
tomFlowee 20da158341 Avoid compile issues in some cases 2021-01-12 17:30:20 +01:00
tomFlowee 2ed836a71d Support buffers for strings too 2021-01-06 23:16:19 +01:00
tomFlowee 407dd2f2ab Simplify messageparser.
Remove some unused methods and complexity.
2021-01-06 19:37:27 +01:00
tomFlowee 6a92cbf695 Add easier way to set the id on a base58 data. 2021-01-05 22:38:57 +01:00
tomFlowee 3fe98afce9 Minor cleanup
This removes some unused includes from common headers and dead code
from some C++ files.
2021-01-05 22:05:25 +01:00
tomFlowee 094ce6907d Clarify code: avoid non-trivial macros 2021-01-05 21:29:44 +01:00
tomFlowee ba5689a4f4 fix BIP37 processing for non-topologically ordered blocks
Summary:
CMerkleBlock::CMerkleBlock called IsRelevantAndUpdate() on each transaction
in order, which (due to the outpoint-adding feature) assumes a topological
order of transactions in order to work correctly. If an outpoint of
interest were created later in a block than when gets spent, then it would
be added into the bloom filter too late, and thus that spending transaction
would get missed.

This changes CMerkleBlock::CMerkleBlock to scan all outputs first, then
make a second loop to scan all inputs. This requires breaking up the
IsRelevantAndUpdate() function into two parts. The original
IsRelevantAndUpdate() functionality remains fully intact however, as it
gets called from mempool-related code (mempool has topological order) and
tests.

Note that vMatchedTxn.push_back is moved into the second loop so that index
i keeps ascending order, in case that is somehow relevant. (the tests at
least do check this)

A two-loop construction like this will very slightly increase the false
positive rate.

Originally by: Mark Lundeberg
2020-12-17 09:49:15 +01:00
tomFlowee 8e44b058af Add flags getter 2020-12-17 09:08:34 +01:00
TomZ 9f0a75839a Process static checks warnings 2020-12-06 13:18:08 +01:00
TomZ d430a4be8a Update all usages of boost create_directories
The API throws when the directories already exist, which is quite
unexpected.
This now changes the code to silently ignore these issues in the
knowledge that the immediately following opening of files will
fail with a nice error message.
2020-11-23 14:09:00 +01:00
TomZ a966ffb129 Remove the hardcoded max message size.
We already had in place the blockSizeAcceptLimit as the limit
on messages, which is now the only limit.

In practice this means when the operator sets the maximum mining
size that we adjust the blockSizeAcceptLimit, if they only set the
blockSizeAcceptLimit, we use that (plus a margin) to limit messages
both on the p2p layer and on the RPC (JSON) layer we change the
limit to be twice the blockSizeAcceptLimit (copied those numbers
from BCHN).
2020-11-10 18:33:07 +01:00
TomZ a337c6b6b5 Use consistent variable typing.
Use uint8 and friends instead.
2020-10-31 19:51:04 +01:00
TomZ 8796dc4b7d Add support for testnet addresses
Notice that we only use 2 type of base58 prefixes, mainnet and everything
else. So this support all worthless chains.
2020-10-30 18:08:09 +01:00
TomZ 7248251a5a Fix warning.
Avoid std::move here.
2020-10-27 16:33:08 +01:00
TomZ b901745139 Add getters. 2020-10-23 22:33:33 +02:00
Justaphf 18ca7abb7c Add scalenet 2020-10-02 18:43:52 -04:00
Justaphf 13286db582 Add testnet4 2020-10-02 18:43:52 -04:00
TomZ 0293890e80 Add optional async job to Hub API
The current design of the API is that all questions are answered in-
order. This implies that handling of one connection will also just use
one thread.

If we want to improve performance of things like "sendTransaction" we
want an async option, which runs the action and generates the answer
when its done in a separate thread (a new one for each async-request).

This breaks the in-order reply sequence for clients and as such it
requires them to set a new header-option to enable this.
2020-09-29 17:34:06 +02:00
TomZ cde4d35d9c API docs 2020-09-18 20:37:43 +02:00
TomZ 1434383f01 Simplify
Lets not be afraid of some pointer math...
2020-09-17 20:55:14 +02:00
TomZ 3b562b00e5 Include for the namespace 2020-09-09 11:46:06 +02:00