Commit Graph

931 Commits

Author SHA1 Message Date
TomZ bf8e4aa3fc Remove silly checkpoint. 2020-10-29 20:17:15 +01:00
TomZ 60f754ef58 Make reindex not delete the 'unspent' dir, but its contents
This is a feature request following the fact that some sysops use a
symlink for the unspent dir and don't want the reindex to delete the
symlink itself.
2020-10-29 18:56:04 +01:00
TomZ 2d90ade9d2 Update specification for testnet4 to actually validate.
Specifically: SCRIPT_ENABLE_SCHNORR.
2020-10-29 18:56:04 +01:00
TomZ 016d9565f2 Remove old detection of outdated UTXO
We have had our new format for so long, this only can give false-
positives now.
2020-10-29 18:56:04 +01:00
TomZ 027c1a19d4 Don't ban without logline. 2020-10-28 22:06:15 +01:00
TomZ 6d330622f2 Handle whitelisted nodes different for DSProof punishment. 2020-10-27 16:33:08 +01:00
TomZ 5d9e290f41 Add TODO for async usage 2020-10-27 16:33:08 +01:00
TomZ 42d883d418 A block inherits its 'tree' status. 2020-10-27 16:33:08 +01:00
TomZ 7248251a5a Fix warning.
Avoid std::move here.
2020-10-27 16:33:08 +01:00
TomZ 67cf8955b0 Drop usage of old log-style. 2020-10-27 16:33:08 +01:00
TomZ 4a183dee98 Add needed include 2020-10-26 22:38:28 +01:00
TomZ b104025f12 Ensure memory leaks are impossible
unique_ptr all the way, baby.
2020-10-26 18:30:39 +01:00
TomZ e7b0995b1a Make testnet4 have standardness rules on 2020-10-26 18:21:52 +01:00
TomZ 4054b9a7d4 Avoid (re)connecting to incoming peer. 2020-10-26 18:21:52 +01:00
TomZ ff58ae6a36 Implement the first ASync API command
This implements the sendTransaction command using the async framework,
allowing clients to benefit from multi-core systems to process
transactions in parallel when being submitted to the Hub.
2020-10-26 18:21:52 +01:00
TomZ cd6937a672 Set the proper default log section specific libs 2020-10-25 23:43:42 +01:00
TomZ 331f1ec773 Fix regression in NWM that disconnects sometimes
This fixes the logic that finds out it should resume an interrupted
process. The code had false positives in case of a message split over
multiple TCP frames.
2020-10-25 23:42:49 +01:00
TomZ b901745139 Add getters. 2020-10-23 22:33:33 +02:00
TomZ 267e5bf142 Fix typo in comment. 2020-10-23 22:33:24 +02:00
TomZ 4b0bcf7bc9 Add priority to privacySegment
We connect to the "first" priority stated segments first, in order to
allow the UX to be made much better since it may take a bit of time to
find peers.
2020-10-19 14:04:57 +02:00
TomZ bf10876914 Add new callback on DataListenerInterface
virtual void setLastSynchedBlockHeight(int height);
2020-10-17 17:25:05 +02:00
TomZ 112ee10f75 Remove stray semicolon 2020-10-17 17:24:45 +02:00
TomZ ff0cec682e Minor cleanups
Avoid copy/paste of comments.
Remove double semicolons.
Add new seeder.
2020-10-13 19:27:35 +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
Justaphf 2edd43806f Activate Nov 2019 & May 2020 HFs by height instead of MTP
and update the definitions of the Mainnet, Testnet (v3), and Regtest chain params accordingly.  The heights for all 3 chains were taken by verifying the values in both BU and BCHN code bases.

NOTE: For TestNet v3, there is a 1 block discrepancy between BU (1378461) and BCHN (1378460) for the height of the May 2020 hardfork.  I arbitrarily selected the value from BCHN, I'm not sure which is correct.
2020-10-02 18:43:51 -04:00
TomZ 54329bf9e4 Add new DSP test to check for stupid usage :) 2020-09-30 10:27:51 +02:00
TomZ 14a938d54c Add speed test
To make sure that a pair of really large transactions being used
to create a DSP doesn't cause a blocking thread, this runs a
benchmark on a pair of transactions with 300 inputs each, causing
45k comparisons to be made.
On my laptop this results in 0.6 msecs for this creation of the DSP.
2020-09-29 20:35:41 +02: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 fdaa6e4a81 Import some improvements from Calin.
* API docs
* Fix possible race condition in addOrphan()
* Reject proofs that violate simple constraints
* clear up possible confusing API (first/double spender getters).
2020-09-29 17:33:20 +02:00
TomZ 68759fbf00 [REST] Add unconfirmed fields to the address/details 2020-09-18 20:40:49 +02:00
TomZ b033cd8ac4 [API] Add outindex field to mempool address search
When you request matching transactions from the mempool for certain
addreses, the API now returns the matched output-index as a separate
tag, which makes it easier to, for instance, use the 'amount' field in
the reply.
2020-09-18 20:40:11 +02:00
TomZ cde4d35d9c API docs 2020-09-18 20:37:43 +02:00
TomZ 3b553fd80b Make sure we handle a close() correctly.
When we close() the receiveStream is cleared and we should not be
reading from it after. So detect and handle this.
2020-09-17 21:51:37 +02:00
TomZ 7afefefa41 Improve NWM flow-control
The NetworkManager now has more mature flow-control which means that we
send our buffers more regularly and we delay parsing received data if the
sending takes too long.

The direct effect should be that creating of a large number of messages
in response to incoming messages is no longer a problem in many cases.
2020-09-17 21:04:28 +02:00
TomZ 1434383f01 Simplify
Lets not be afraid of some pointer math...
2020-09-17 20:55:14 +02:00
TomZ 84ee1bc3fe Minor: comments and whitespace. 2020-09-17 20:53:56 +02:00
TomZ f0375c09a7 Fix bad memory access on sending prio message
Don't ask the size of an unitialized buffer.
2020-09-17 20:51:06 +02:00
TomZ 5f071d9ef7 Request indexer for version and display 2020-09-14 23:02:52 +02:00
TomZ 8b2c928fae Fix comment confusion (add 'not') 2020-09-14 22:48:03 +02:00
TomZ 352644fc05 [REST] Make transaction/details also fetch from mempool
This uses the new MempoolSearch api in order to allow the REST API to
fetch and display transaction data which has not been confirmed yet.
2020-09-14 15:30:51 +02:00
TomZ fcc3b094ef [API] Improve featureset of MempoolSearch
The mempool search now shares its serialization code with the blockchain
transaction fetcher, allowing all the filtering and include flags to work
here too.
This also fixes several bugs and reverts the mempool API change.
Additionally I return the FirstSeenTime for each mempool entry.

There is a slight API breakage in the LiveTransactions service, which as
far as I know is still unused outside of Flowee.
These enum values changed:
Api::LiveTransactions::
  Transaction   20 =>  25
  UnspentState  23 => 26
  OutputScript  24 => 23

The reason for this change is to have the Blockchain namespace in
sync with the LiveTransactions namespace for similar features.
2020-09-14 15:27:15 +02:00
TomZ b2e39b4ae6 Introduce new Job type matching the new SearchMempool API message 2020-09-11 18:54:21 +02:00
TomZ 88028c3c77 Make flags be initialized faster
This fixes a regression which caused the hub on startup to not get any
validation flags until a new block was added to the chain.
2020-09-11 18:54:21 +02:00
TomZ 6fb9310007 Avoid work
When a block header is rejected before it has been added to the header-
chain, we don't have to update the header-chain.
2020-09-11 18:54:21 +02:00
TomZ db9a80f8eb [API] Add support to query the mempool
This allows a search based on TxId or output-script-hash for
mempool transactions.
We include double spend proof info when available in the reply
2020-09-11 14:07:14 +02:00
TomZ bf921a4267 [REST] Add sendRawTransaction GET support. 2020-09-09 14:52:50 +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