Commit Graph

866 Commits

Author SHA1 Message Date
TomZ 679374e923 Revert chain-switching idea
It becomes messy due to the usage of the compact form on block headers.
2020-08-16 12:03:19 +02:00
TomZ ac6b4934f2 Fix off-by-one in isStandard
Our max tx size has always been 100KB, the implementation rejected 100KB
and above, though.
This follows the major clients doing ths same.
2020-08-16 12:03:12 +02:00
TomZ 750bd23b27 Work around badly picked default variable value.
A not yet saved file has file-index zero, which is valid...
Also check this state and allow deletion of rev zero.
2020-08-13 18:28:43 +02:00
TomZ 59c468decf We now check if a revert file has become useless and delete it
If we are past at least 2000 blocks of the items stored in a data file we
can delete the revert file and save a couple hundred megabytes of
on-disk storage for every blk file.
2020-08-13 13:32:01 +02:00
TomZ 90988c80a9 Fix reindex sometimes taking forever on a block file. 2020-08-13 11:45:02 +02: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 337b34ea8e Update error message
We seem to be having a LOT of p2sh double spends on mainnet today,
which caused confusion with people reading the logs.
This clarifies that the current version only supports p2pkh and we
need more research to support others too.
2020-08-10 10:13:02 +02:00
TomZ d2802474c5 Add bchd testnet seeds 2020-08-10 10:13:02 +02:00
TomZ c4d5304d52 Make findOrphans() method const 2020-08-10 10:13:02 +02:00
TomZ 297a22dfa8 Move and fix partitionCheck()
Small refactor; move the partition check away from main and the obsolete
global variables we used to use, instead now just add it to the DB which
owns the data it works on.

This fixes the bug that in various cases we'd incorrectly get a warning
about no blocks being found in the last N hours.
2020-08-10 10:13:02 +02:00
TomZ dda576b4bc Fix some warnings
Code cleanliness nitpicking.
2020-07-31 15:58:15 +02:00
TomZ c244c94634 Add new Indexer API message: 'version'.
This mirrors the one in the Hub in that it returns the version of the
Indexer running on the server.
2020-07-27 21:27:26 +02:00
TomZ 8e1eefaa81 Improve error message
when user specified wrong offset, send them an error.
2020-07-27 21:26:21 +02:00
TomZ dcff0532dc Improve error message
When missing argument, return to peer a specific message
2020-07-27 12:34:27 +02:00
TomZ 513bde1f7a Avoid unneeded check 2020-07-23 14:46:15 +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 a6c7d1604a Make possible to just compile/install libs
At popular demand, move the installing of the cmake support file
that lets external projects find the Flowee libs to our libs dir.

This has the effect that a user can selectively compile and install
the libs dir only in order to use our libraries.
2020-07-05 16:14:50 +02:00
TomZ 648eb56c9d Drop cmake add_dependencies() calls
When we made the 3rdparty libs be build by cmake the need to manually
add dependencies became irrelevant.
2020-07-05 12:50:09 +02:00
TomZ 671bb4e1e1 Add readme for the libs subdir 2020-06-29 22:34:07 +02:00
TomZ 32251471a5 On fetch-block, also notify about each transaction.
The callback on each transaction was only called when individual tx
were fetched, which is "magic" behaviour and I don't like
inconsistencies.
So, also call the callback for each transaction in a block we fetched.
2020-06-19 16:40:29 +02:00
TomZ c5a8181299 Pre-allocate a larger buffer
This will most likely benefit some FloweeJS users when they do some stuff
that I didn't think a good idea, at least this way they will not get 
a bunch of errors :)
2020-06-19 16:40:29 +02:00
TomZ 7e5d3a98dd Fix in apputils/blockchain (floweejs) for assert
This assert would hit in some cases, due to coinbase not getting a
prevtx field.

This solves that properly.
2020-06-19 16:40:29 +02:00
TomZ e8f7698560 Remove stray log-lines. 2020-06-19 16:40:29 +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 652fc1e161 Introduce structure to broadcast transactions.
To send out transactions in the p2p net is quite a lot of work,
you need to find multiple peers to send the transaction to. First
you send an INV, then you respond to a getData to actually send
the transaction and last you wait for 'reject' messages that may
indicate that there is something wrong with the transaction.

This introduces the BroadcastTxData class that wraps a transaction
and gets callbacks for sending and for rejects, abstracting away
all the complexity for the user.
2020-06-08 21:35:10 +02:00
TomZ c2de615c97 Use enum 2020-06-08 21:31:00 +02:00
TomZ a56ff62c0d Add some useful TransactionBuilder API 2020-06-08 18:47:09 +02:00
TomZ fa18524d77 Update URL to ref-doc. 2020-06-08 18:05:05 +02:00
TomZ cf01da9164 API review: privacySegment
The uint256 and CKeyID classes are the same baseclass with template
differences only, which makes them fragile to use for overloading.

As such rename the convenience overload slightly.
2020-06-07 13:56:55 +02:00
TomZ c92b722c0f Fix test that broke on new Qt version
The usage of byte-array in json is not well defined, and as such Qt just
no longer handles it as it could end up causing out-of-bounds issues.

This misuse is limited to our unit test, so this is a cheap update.

Ref; https://bugreports.qt.io/browse/QTBUG-84739
2020-06-05 18:04:56 +02:00
TomZ ef90ed79d6 Avoid overloading virtual method
Instead of using open(), which makes unavailable the normal method,
use a new methodname instead.

This issue is a bit of an anti-pattern and it would likely be beneficial
to avoid having this as a subclass at all.
2020-06-05 16:44:39 +02:00
TomZ 73bc9b78ad Pimpl transactionbuilder and install 2020-05-28 22:34:49 +02:00
TomZ 5dce540238 Make clang happy; override 2020-05-27 12:14:15 +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 2e29bc4f6e When saving to non-existing dir, handle the error. 2020-05-23 14:03:29 +02:00
TomZ a96e927d10 const fix 2020-05-21 19:33:29 +02:00
TomZ 60f1864b74 API review. Use isClosingDown() 2020-05-21 19:33:13 +02:00
TomZ 6d9881f413 Play with punishment
Based on the idea that randomly selecting a peer from our database will
prioritize based on the peers punishment score, this sets the punishment
for never connected-to peers at 10 (out of 1000) just to give a minor
benefit to speeding up the meshing.
2020-05-20 20:31:19 +02:00
TomZ 5b63dd4c9b P2PNet: Peer downgrades log-level 2020-05-20 15:20:09 +02:00
TomZ 69a7db91ec Introduce TransactionMonitorService
This supplies a push notification on txid becoming known to the Hub.

Additionally this changes its close relative the AddressMonitorService
to use a different tag for the transaction data and the
double-spend-proof data so as to make it obvious which one is being
sent.
2020-05-19 20:57:51 +02:00
TomZ 82dfd082cd Initial support for a Transaction Monitor API 2020-05-19 08:29:31 +02:00
TomZ 52f40acb93 Speed up loading 2020-05-19 08:27:53 +02:00
TomZ a5e6bea027 Merge branch '2020.03' 2020-05-18 22:52:19 +02:00
TomZ e9a2437c2d Add unit tests for UTXO and fixes
This fixes that the .info file is sometimes not written when nothing
changed in the db file.

This fixes that the info file with .1.info extension is reused again
and again, effectively reducing the usefulness of the snapshots.
This only really affects the indexer as pruning avoids this most
of the time.

Closes issue flowee-issues#6
2020-05-18 22:51:41 +02:00
TomZ 7ba11b9880 Unify usage of random number generator. 2020-05-18 19:53:11 +02:00
TomZ 45d9ac3bd2 Make Peer listen to Bloom filter changes 2020-05-18 14:32:34 +02:00
TomZ cde1372b2e Make PrivacySegment emit signals
this adds a listener interface and a way to emit the callbacks on
changing of the filter.

This also adds a mutex since we expect the Peer to use the filter which
will likely live in its own thread.
This makes the class thread safe and re-entrant.

Notice that we use a recursive mutex to allow various usecase on
altering the bloom filter.
The most involved one is a complete replacement which calls clear and
then various calls to add() style methods.
Second is a single 'add' which can be done without the clear first.

The second needs an explicit lock in the add() methods, which would
deadlock in the first usecase if I didn't pick the recursive mutex.
2020-05-18 14:25:14 +02:00