Commit Graph

23 Commits

Author SHA1 Message Date
tomFlowee 639a57d957 [Refactor] primitives/BlockHeader -> BlockHeaderFields
This avoids a naming conflict with a p2p class BlockHeader.

Notice that the block data structures are mostly still private API, they
are in the utils dir but headers are not installed, nobody has needed
them so far.
2021-11-02 11:05:14 +01:00
tomFlowee 50af3dc02c [Refactor] rename FastBlock.{h|cpp} -> Block.* 2021-11-02 10:24:58 +01:00
tomFlowee 6ff0e7c0de [Refactor] FastBlock -> Block 2021-11-02 10:18:24 +01:00
tomFlowee 4689cc6a92 [Refactor] CBlock -> MutableBlock 2021-11-02 09:36:09 +01:00
tomFlowee 64d901d760 Refactor; CBlockHeader -> BlockHeader 2021-11-02 09:28:35 +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 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
TomZ 67cf8955b0 Drop usage of old log-style. 2020-10-27 16:33:08 +01:00
TomZ 84ebae427e Import ASERT DAA
This includes renaming some methods which makes the import look larger
than it really is.
2020-08-12 21:42:54 +02:00
TomZ 2aa462f8bb Replace SigOps with SigChecks
This is part of the protocol upgrade for 2020-05-15, and in general it
seems to go the direction of "we did this before, lets do this again".

The spec is clear enough, but there is still a lack of questioning and
testing. The problem this attempts to fix has been neutered for years[1].

The spec states:
> The essential idea of SigChecks is to perform counting solely in the
> spending transaction, and count actual executed signature check
> operations.

This, however nobel and logical, ignores that the
check-for-being-too-costly just pulled in a UTXO lookup and the loading
of the output script from the historical chain.
The goal that we protect against CPU over-use may be reached, but the
price is a total system slowdown. You can have multiple CPUs, but the
bus to permanent storage has one, max 2 parallel pipes.

To ensure theHub stays the number one scalable node, I didn't blindly
follow the spec, while making sure that the Hub is correctly going to
follow/reject consensus violations of newly mined blocks.

As a result the implementation in Flowee the Hub:

* does not check sigcheck-counts on historical blocks (more than 1000
  blocks in the past).

  This may increase the risk of chain-splits ever so slightly, but the cost
  of disk-IO would be too high.

* No longer stores the value in the mempool, nor uses it for the
  CPU-miner.

* Ties the sigcheck-limits to the user-set block-size-accept-limit.

  This is contrary to the spec which mistakenly thinks that BCH has a
  max block-size in the consensus rules. The effect is the same, though.

* The per-intput standardness suggestion is not implemented because
  standardness checks don't currently fetch the previous outputs and
  that would be too expensive to add.

* Standardness rules for the whole transaction are moved to the
  mempool-acceptance logic instead. The cost would be too great
  otherwise, similar to the previous point.
  Again, the effect is the same as likely intented.

---
1) since the intro of the CachingTransactionSignatureChecker
2020-04-13 15:57:42 +02:00
TomZ ba76c35a7d Move merkle to flowee_utils libs
Merkle-block and merkle-tree classes and methods are pretty much stand-
alone and can be moved with no efforts.

Also move the relevent unit test to qtestlib.
2020-04-01 22:53:07 +02:00
TomZ 7593d06473 Use blockheight to enable historical features
We used various ways to enable new features over the last 10 years.
We can remove that legacy code and just set the blockheight.

This cleans up the code quite a bit.
2019-10-14 19:24:19 +02:00
TomZ 0cac942685 Replace boost::bind with std::bind
This is done almost everywhere, I skipped the boost signals since thats
only really used in the GUI part which is just there to do testing.
2019-10-10 16:18:53 +02:00
TomZ 174e9b55dd Make regtest generate() create min 100bytes txs.
The rule that transactions need to be at least 100bytes was honoured for
normal mining already.
Now unit tests and txVulcano which call RPC 'generate' will also comply.
2019-06-16 23:04:14 +02:00
TomZ 707d2212de Move encoding (base58) out of server lib
Also write some new accessor methods on the baseclass.

The longer term idea is to make the server itself only use the uint160
raw version for bitcoin addresses.
For now move the encodings (between that uint160 and human-readable) to
the utils library.
2019-04-11 16:20:04 +02:00
TomZ a2b9f23246 Make generate() available through the API
This is a regtest only method, so limited usage.
2019-03-17 22:49:46 +01:00
TomZ b3331db7cd Fix log levels 2019-03-15 19:15:28 +01:00
TomZ cfe690320d Move various standalone simple classes into utils
The 'server' library has always been a catch-all and
ideally only the hub links it in (far future goal).
In line with this I move a list of files out of server
into the utils lib.
I choose 'utils' because all these are plain old data
objects that many crypto apps will find useful.

now in utils/primitives/
* CScript
* CPubKey
* CTransaction
* CBlock
* FastTransaction
* FastBlock
* CScript

streams.h is now in utils/streaming/
hash.h is now in utils/
2019-03-11 15:40:42 +01:00
TomZ 830726ef88 Make mining work again.
* Make mining software honor CTOR resorting.
* Fix bugs
2018-11-20 20:44:06 +01:00
TomZ 9aab378b0a Add checks for 100 bytes min tx size 2018-11-15 23:34:05 +01:00
TomZ 1600086ede Updates to and start using the UnspentOutputDB
The new UnspentOutputDatabase classes are only very loosly a database, we
purely register and store unspent outputs there. But unline a DB we don't
allow modification (just insert and delete).

This replaces the coin-db (which was based on leveldb) and as first goal
this gives us a higher level of stability. The level-database was known
to give corruption issues.

Notice that users will need to do a manual reindex on first update.
2018-07-23 19:49:32 +02:00
TomZ 33fe0fccb5 Cleanup ValidationInterface
Get rid of the weird boost signals setup
Move it to a new library 'interfaces' which is
for stuff that has no dependencies and can avoid
creating inter-library or cicular dependencies.
2018-02-16 12:37:13 +01:00
TomZ 14bf96aa3c Start libs/server 2018-02-13 13:27:58 +01:00