Commit Graph

73 Commits

Author SHA1 Message Date
tomFlowee 33d1bc27f4 Work slowly to fix the disease of unsigned char
There factually is no difference between char and unsigned char
except in very rare cases (like bitshifting). But in APIs they
are incompatible, which is a pain...
2023-07-15 12:24:40 +02:00
tomFlowee 58afd8ab6a Make compile with older libc 2022-09-13 20:30:38 +02:00
tomFlowee 05bbba3cb3 Rename class CKey -> PrivateKey 2022-07-06 22:12:33 +02:00
tomFlowee 0f91e9ac46 Remove dead code 2022-07-06 22:08:50 +02:00
tomFlowee c9af7cca4a Rename class CPubKey -> PublicKey 2022-07-06 21:56:34 +02:00
tomFlowee c33d54ed7d Rename class CKeyID -> KeyId 2022-07-06 21:52:47 +02:00
tomFlowee 1572608605 Make this explicit
Since the default copy constructor of the HDMasterKey uses the copy
constructor of CKey, make the latter have a copy constructor explicitly
defined as well.
2022-07-06 14:10:23 +02:00
tomFlowee 9fa877f425 Rename hashing methods to start with lowercase 2022-05-17 00:46:54 +02:00
tomFlowee cca8a885bc Fix coding style issues
Follow the coding styleguide and make the methods lowercase on CKey
2022-05-11 13:46:15 +02:00
tomFlowee 7b57024413 Make set() be internally consistent
setting an incorrect value should not keep the old data after we already
update the fValid boolean.
That would give the user the impression that the data was removed while
it really isn't.
2022-05-11 13:20:15 +02:00
tomFlowee 0d4b214e23 Move over to the new allocator 2022-04-06 10:24:16 +02:00
tomFlowee 1b5ae89d31 [Refactor] rename FastTransaction.{h|cpp} -> Tx.* 2021-11-02 11:05:14 +01:00
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 dce57fd8ea [Refactor] rename block.{h|cpp} -> MutableBlock.* 2021-11-02 10:13:23 +01:00
tomFlowee 406dc46671 [Refactor] move CBlockLocator to libs/server
Its not needed anywhere outside the apps.
2021-11-02 09:59:13 +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 b8e6ddfb19 Add a specific operator=
This avoids checkers being worries about the inconsistency of a
specific copy-constructor but a generic assignment operator.
The assignment operator can be generic because locking doesn't
care what the content is.
2021-10-13 17:06:58 +02:00
tomFlowee 4252e859e7 Remove obsolete (and untested) code. 2021-10-13 17:06:58 +02:00
tomFlowee 2308600929 Add convenience constructor. 2021-07-26 15:01:25 +02:00
tomFlowee ae78dd0bb8 Update email address 2021-06-20 22:44:44 +02:00
tomFlowee 28af16d536 Add TransactionBuilder::pushOutputPay2Script() method
Code modified from snipped shared by user Sandurr on noise.cash.
2021-04-22 12:46:35 +02:00
tomFlowee 793e4ed48d Fix warning: add assignement operator when we have copy-constructor. 2021-04-19 16:29:23 +02:00
tomFlowee 6d33d187d4 Add new CKey::signSchnorr() method. 2021-04-19 15:49:56 +02:00
tomFlowee 6682a4a5b2 Rename CKey::Sign() -> signECDSA() 2021-04-19 15:45:02 +02:00
tomFlowee fcb648916d Make pubkey follow coding styleguide 2021-04-19 14:48:18 +02:00
tomFlowee d797b1bf50 Minor additions of helper methods.
Tested in the upcoming unit test.
2021-03-24 21:00:25 +01:00
tomFlowee aa57e4bbb2 Merge branch 'blockMetadata' 2021-03-12 14:12:11 +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 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 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
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 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
TomZ 9429baf3dc Increase Tx init version
We don't actually use any new features, but users of our libraries might,
so just default to the new version.
2020-06-19 16:39:59 +02:00
TomZ 7fb776f815 Avoid CLANG warning and make this clearer. 2020-05-27 11:36:28 +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 414bee9e9f Implementation of OP_REVERSEBYTES
Previously named OP_REVERSE, then OP_BSWAP, then OP_ENDIAN_REVERSE.
2020-04-10 15:17:18 +02:00