Commit Graph

189 Commits

Author SHA1 Message Date
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
TomZ 67f0535607 Squashed commit of the following:
commit f1c09cbbdf228cefbfbd339567ba337083e93e52
Author: TomZ <tomz@freedommail.ch>
Date:   Wed Sep 2 13:56:38 2020 +0200

    Fix sorting in address/utxo call

commit c61b03b05de04c9d53c6fdf413dd1b6d33dc17f6
Author: TomZ <tomz@freedommail.ch>
Date:   Wed Sep 2 13:03:43 2020 +0200

    Also catch missing services for more complex searches

    We did catch it on 'start()' which may not actually use a service that
    was missing and only in a followup would the missing service be used.
    So also catch the exception for missing service on the other event
    handling methods.

    This means that we now show a nice "setup needed" message to client when
    a call is done that is not supported because of missing backing service.

commit fbcfe60c7d21b309e9c827dd927de0e196d7f5b6
Author: TomZ <tomz@freedommail.ch>
Date:   Tue Sep 1 16:03:19 2020 +0200

    Also use the complex UTXO lookup to do callbacks.

commit d948225ae7786aa6b62ff9355c2d768a85569642
Author: TomZ <tomz@freedommail.ch>
Date:   Tue Sep 1 15:47:48 2020 +0200

    Add address/utxo call.

commit cbc4695d4abae1404afe03f34b10427e48f819ae
Author: TomZ <tomz@freedommail.ch>
Date:   Tue Sep 1 14:34:31 2020 +0200

    Add address/details API call

    This mostly implements the API call to list an address.

commit 1d215032af09551e2b3eda314c072a200e5fb37a
Author: TomZ <tomz@freedommail.ch>
Date:   Tue Sep 1 14:30:26 2020 +0200

    Fix warnings

    This fixes warnings from the compiler and the linter.

commit b61e7dd42222537b456a79e14439a0d36007e8d7
Author: TomZ <tomz@freedommail.ch>
Date:   Tue Sep 1 14:27:27 2020 +0200

    Blockchain::Search: Clean a little and fix bugs

    This follows the API docs on the utxoLookup() callback and we indeed
    return back the blockheight/etc parameters even if the utxo is already
    spent (represented by unspent=false).

commit 7ec3ebf937d7f2fb6a7a18f21d2e8b645db6fe3e
Author: TomZ <tomz@freedommail.ch>
Date:   Mon Aug 31 12:24:18 2020 +0200

    Fixes and move to v2 url

commit 32b8018af805ce068da7d3e149add66a90c92264
Author: TomZ <tomz@freedommail.ch>
Date:   Mon Aug 31 11:29:35 2020 +0200

    Build the rest service

commit c386adff9d28a0f844916019602ea0032bbc360a
Author: TomZ <tomz@freedommail.ch>
Date:   Sun Aug 30 19:24:29 2020 +0200

    Cleanup old code and make vin work

commit 5b88457863892ff8391e42a7eff61cd243851b41
Author: TomZ <tomz@freedommail.ch>
Date:   Sun Aug 30 18:42:41 2020 +0200

    Output addresses.

commit 46c2ce680409c38f1a67730e23cde942db2ecc46
Author: TomZ <tomz@freedommail.ch>
Date:   Sun Aug 30 17:51:03 2020 +0200

    Make tx-refs easier for the Blockchain::Search

commit b0591b5a6b57e2eb7022db7b7a351c694220e5ad
Author: TomZ <tomz@freedommail.ch>
Date:   Fri Aug 28 18:28:48 2020 +0200

    Make printing of tx work better

commit d337ac91ad4ab9eeb768695c639dcbbbcc463837
Author: TomZ <tomz@freedommail.ch>
Date:   Fri Aug 28 15:46:04 2020 +0200

    Make rest service show a nice help for setup.

commit 5997ff1fa06bd1a6b51ead93eef094a5561fdb53
Author: TomZ <tomz@freedommail.ch>
Date:   Wed Aug 26 17:43:09 2020 +0200

    Parse the json automatically.

commit 5ed7d6e53761828e2e385e085f44d530449b0b3b
Author: TomZ <tomz@freedommail.ch>
Date:   Wed Aug 26 13:07:04 2020 +0200

    Start project rest-service.
2020-09-02 14:58:09 +02:00
TomZ c7aee5efa9 Prevent incorrect usage and double delete
This only applies to the case where the MessageBuilder was used without
an external pool, but lets make sure the code is robust for even that
case.
2020-09-02 13:54:45 +02:00
TomZ dce928921f Minor docs updates for log file creation. 2020-08-28 15:46:32 +02:00
TomZ 370abe4c1e Follow several code-check suggestions
Also print a line explaining which file the logs go to in case there
is no config.
2020-08-26 14:08:03 +02:00
TomZ 127f675bd5 Add logging primitives. 2020-08-16 12:35:33 +02:00
TomZ 5e28bc14b2 Fix return-type 2020-07-17 22:07:15 +02:00
TomZ 59ac2f259c Update default timeout
Transactions are only kept in the mempool a limited time before they are
removed and have to be re-entered by the owner of the transaction.

To keep mempools from being too different from the rest of the network we
can flush them based on the fact that if a tx hasn't been included yet in
this time, miners are not seeing it.
2020-07-07 11:16:16 +02: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 a56ff62c0d Add some useful TransactionBuilder API 2020-06-08 18:47:09 +02:00
TomZ 73bc9b78ad Pimpl transactionbuilder and install 2020-05-28 22:34:49 +02:00
TomZ f586adf430 Fix clang warning; use static via class, not instance. 2020-05-27 11:59:49 +02:00
TomZ 7fb776f815 Avoid CLANG warning and make this clearer. 2020-05-27 11:36:28 +02:00
TomZ 33c6758ea5 Add some API docs. 2020-05-23 14:03:42 +02:00
TomZ a96e927d10 const fix 2020-05-21 19:33:29 +02:00
TomZ 43d7626d46 P2PNet make the blockchain class save its state. 2020-05-11 15:16:59 +02:00
TomZ dc9a92c57e Also install the new header. 2020-05-07 15:38:32 +02:00
TomZ 25ffc84f80 Introduce new lib p2p
We reuse the NetworkManager lower level code in order to connect
to the Bitcoin P2P network.
This implements the basics for anyone wanting to be a player on
this network.
2020-04-20 21:49:03 +02:00
TomZ 37d8209d64 use constexpr 2020-04-17 17:32:16 +02:00
TomZ 2870f42ad3 Split PartialMerkleTree out into its own header.
Additionally:
- add loading to it from a P2PParser
- move code from header to cpp file
2020-04-17 17:31:46 +02:00
TomZ 4506e3d639 Start new streaming classes for the p2p protocol
And implemnt saving in the bloom filter for test
2020-04-16 17:12:57 +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 fd7a75bc2f Make sure this builds also without build.h 2020-04-10 21:13:12 +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
TomZ 4733554817 Make bloom class more modern
This follows the coding style (method naming) better and it adds
an insert method which uses a Streaming::ConstBuffer argument.
2020-04-10 12:21:49 +02:00
TomZ e8028035a1 make univalue build using cmake 2020-04-08 22:48:29 +02:00
TomZ 1144f013a4 Build secp256k1 with cmake 2020-04-08 22:48:29 +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 9276a45faf Move bloom filters to flowee_utils lib
Also move its unit test from the boost to qtestlib
2020-04-01 22:24:26 +02:00
TomZ 0c15e877a2 Move arith_uint256 from server to utils lib 2020-04-01 20:22:55 +02:00
TomZ 54a07cbdfc Add new log group for future component 2020-03-29 12:55:12 +02:00
TomZ 7b1b742036 Remove workaround for old boost version
The API changes in boost between 1.66 and later was the need
for the boost_compat.h header file.
Its been a long time since Flowee started demanding 1.67 minimum
for boost, making this compat obsolete.
2020-03-29 12:55:12 +02:00
TomZ 8b365263de cleanup 2020-03-29 12:55:12 +02:00
TomZ 4e0b42d205 Fix BufferPool::forget()
Using the forget() method too many times could lead to an invalid
(negative size) ConstBuffer being created.
This fixes and immediately copies an assert used in many other places in
the code already.
2020-03-19 15:05:54 +01:00
TomZ 00d4905db2 Provide another convenience method for making messages
THe builder now allows you to create a message with the
serviceId, the messageId and the requestId pre-set.

This benefits code that just takes the output from the
builder and calls 'send' on it immediately saving several
lines of code.
2020-02-19 16:55:46 +01:00
TomZ 05048a2109 make non-debug builds more useful for unit tests in debug build 2020-02-19 16:55:46 +01:00
TomZ 999772a748 Allow usage of the logger outside of Flowee
Ship unit-testing functionality in the releease builds too,
external users may want to compile their apps in debug mode while
flowee is a release build.
2020-01-30 15:29:03 +01:00
TomZ 071629852a Treat DSP orphans with dignity
This improves the double spend proof orphans code.
Also add a DSProof log-category and lots of log lines to make
looking at a debug build much more fun.
2020-01-12 17:41:53 +01:00
TomZ 7e01498eba Add operator== to class Tx 2020-01-04 21:08:38 +01:00
TomZ d93faff5a3 Fix C++11 compiler warning
also fix potential memory out-of-bounds write issue.
2020-01-04 14:20:22 +01:00
TomZ 3315aec93f Add ConstBuffer::operator==() 2019-12-30 17:37:23 +01:00
TomZ 6e8c0b29f7 Also here, report minor ver as hex.
Also fix some compiler warnings
2019-12-12 17:48:48 +01:00
TomZ 9d77814cc0 cleanups and splits
The recent introduction of helper methods on pubkey.h had the
side-effect of pulling in crypto libraries.
This splits the static methods into a separate namespace and file
to avoid such cross-module dependencies.
2019-11-13 19:09:24 +01:00
TomZ 175096b2bd Refactor: move files
Move some files back to the server "library".
Merge the 'console' lib with server, as it doesn't really make sense with
just one file and nobody exclusively linking to it.

The server "libary" is not really a library, its the place we put all
the files shared by hub-qt hub-cli and hub.
We no longer depend on these files from other places (mostly due to
moving to the new logging framework) and as such we can move the files
back.
2019-11-13 19:09:24 +01:00
TomZ d573e307c3 Refactor; move SplitHostPort to utilstrencodings 2019-11-12 15:35:54 +01:00
TomZ e7ad998d57 Add -fPIC to installed libs 2019-11-04 14:20:50 +01:00
TomZ 79e4974d19 Port API getblock::filter to use script-hash
The API call for GetBlock has a filter-on-address functionality which is
now ported to no longer use ripe160 addresses but instead uses output-
script hashes.
This avoids problems for transactions not using p2pkh and generally is a
cleaner solution.

This also adds a unit test to test this feature.
2019-10-20 22:12:09 +02:00
TomZ f1d0a68579 Port address monitor service to use address-hash
Remove addresses of type ripe160 to be used in the API of AddresMonitor
API service. Instead use a sha256 hash of the entire output script.

This is mostly internal changes not affecting the operations much.
2019-10-20 20:17:17 +02:00