435 Commits

Author SHA1 Message Date
TomZ b09fa3ab7e Minor fixups
This makes the whitespace usage more in line with the standard.

This also moves an implementation of a virtual method to the cpp file
in order to avoid dynamic linking issues down the line.
2019-10-09 19:35:14 +02:00
TomZ 4e9f66a335 Remove unused CScript::isCommitment() method. 2019-10-09 19:16:52 +02:00
TomZ bba96f3805 Remove unused member 2019-10-09 19:13:03 +02:00
TomZ 80f27ee26d Make CheckMinimalPush exposed and unit test it. 2019-10-08 14:24:22 +02:00
TomZ 922d8b1f16 Fixlets in types 2019-10-05 16:08:37 +02:00
TomZ 9107d7d3b9 Change member from CScript to ConstBuffer
The Tx::Output struct can do better by keeping the ConstBuffer as
converting to CScript is cheap, the other way around is not.
2019-10-05 16:08:37 +02:00
TomZ 14cd5397db Add convenience methods to ConstBuffer 2019-10-05 16:08:37 +02:00
TomZ 2e37162aa1 AppUtils lib; add search API
The core APIs in Flowee are quite low-level and especially combining
results from multiple services becomes tedius, verbose and thus
error-prone.

For this reason I wrote a new SearchEngine and related classes which
allow one to create a single compound request, submit it to the engine and
get a callback when it is done.

For instance one can now create a request for a transaction by txid and the
system will split this into a txid-lookup and the actual fetch for the
transaction.
Enough callbacks and options exist to be able to add a lot more details
this way in a simple manner.
2019-09-23 11:03:36 +02:00
TomZ 7390bea9eb Use proper integer width in api. 2019-09-13 23:45:53 +02:00
TomZ aa15896386 Fix constness and use nullptr 2019-09-12 15:22:34 +02:00
TomZ 0412ae756a Simplify this code
This removes some of the experimental additions that no longer are
used and as such restores the older, simpler, design.
2019-09-04 14:12:38 +02:00
TomZ 0b152570ee Add ConstBuffer::startsWith()
and include unit test.
2019-08-26 20:48:12 +02:00
TomZ 0af7ef1ead add isEmpty() on ConstBuffer 2019-08-24 22:25:10 +02:00
TomZ e7a7ada953 Cleanup dependencies a bit more.
This means that for apps like 'pos' no longer link against libSSL

The streams no longer zero-after-free, there are no secrets transported
in datastreams so this is useless and avoids linking in one OpenSSL
call.

The insecure_rand() method depended on the openssl code to seed it with
randomness. Now replaced with a proven current-time-milliseconds.
This is enough in those cases because it was always meant to be an
insecure random.
2019-08-24 22:25:10 +02:00
TomZ df7de2ecd2 Clean up the hairy ball of util.cpp
Move some globals and all stuff pulling in crypto to the
server/serverutil.cpp file

Remove dead code.

Move several items that were used in only one place to the respective
files using them.

Move the class WaitUntilFinishedHelper into its own file.

Made sure no header includes utils.h
remove a handfull of files including utils.h for nothing.
2019-08-24 22:25:09 +02:00
TomZ d8248aa821 Small refactor; move code.
Move some methods about arguments from util.cpp to Logger.
This makes the logger more stand-alone and this avoids the
global defined in util.h (still to be fixed in future..)
2019-08-23 22:48:39 +02:00
TomZ 1fc9f1fbf8 Add default argument to mid() 2019-08-23 22:34:33 +02:00
TomZ d2cf95d540 Add helper methods Message::matches(...) 2019-08-16 23:40:23 +02:00
TomZ c1fa50d7f8 Handle when user asked to log to a file we can't open
This now logs that problem to the console.
2019-08-12 21:51:42 +02:00
TomZ 60195ba472 Change defaults, stop enabling xthin by default. 2019-08-12 11:08:48 +02:00
TomZ 08c7502bab Make logger log errors found at config parse time. 2019-08-05 23:00:52 +02:00
TomZ 3cd54ed5e6 BufferPool; Add simple way to parse a hex string 2019-08-05 23:00:52 +02:00
TomZ fc7f1d519c Add QList debug operator. 2019-08-05 20:17:45 +02:00
TomZ e07083dd85 Make uint256::Compare simpler and be unit-tested 2019-07-29 22:47:36 +02:00
TomZ 3383d1e1dc Add method MessageBuilder::reply()
This is an overload of message() specifically meant to build
replies to incoming messages.
The behaviour changed here is that incoming messages with
headers other than "RequestId" now get copied to the outgoing
message by default.
2019-06-24 19:53:24 +02:00
TomZ 2b8e71a2ee Replace some left over BTC instances with BCH 2019-06-15 16:19:27 +02:00
TomZ 0bde548548 Improve allocation behavior in BufferPool
The old algorithm could end up doubling the size every time it
ran out, which eventually consumes all memory.
This way we reset to the user-default size when useful and increase
only based on need.

This means that the programmer needs to make a better estimation on
maximum size of messages, but it avoids behavior similar to memory
leaks.
2019-06-13 13:14:26 +02:00
TomZ 0a916c21e9 Add UTXO support to APIs
Generically this looks like this;

IsUnspent
[
  { "txid": "0x111111", "output": 1 },
  { "txid": "0x111111", "output": 11 }
]
IsUnspentReply
[
  { "blockHeight": 1111, "offsetInBlock": 1111, "unspent": true },
  { "unspent": false }
]

GetUnspentOutput
[
  { "txid": "0x111111", "output": 1 },
  { "txid": "0x111111", "output": 0 }
]
GetUnspentOutputReply
[
  { "blockHeight": 1111, "offsetInBlock": 1111, "unspent": true,
    "amount": 1111, "outputscript": "bytearray" },
  { "unspent": false }
]

note: txids are naturally always sha256s.
2019-06-10 21:02:15 +02:00
TomZ 99e7f8656c Make headers go to nice subdirs 2019-06-07 09:53:05 +02:00
TomZ b327821236 make compile 2019-06-07 09:53:05 +02:00
TomZ 449f91f46d Move solver method to utils lib
The code that detects standard script-types is now available as a
library function, renamed to live in a namespace;
Script::solver()
2019-06-06 22:21:46 +02:00
TomZ d0662d6e22 Install more headers. 2019-06-03 21:37:30 +02:00
TomZ a1dfd1cde9 Work on installable headers 2019-06-03 10:59:33 +02:00
TomZ 7203a058a3 Change API call SplitHostPort slightly
Instead of taking an int for the port, take a short.
This matches better with the networkmanager EndPoint struct.
2019-06-02 20:16:49 +02:00
TomZ db9eb1adfb Install some more files 2019-05-30 13:36:57 +02:00
TomZ 6a8313252d Merge branch '2019.04' 2019-05-15 20:45:18 +02:00
TomZ 5996205a07 add checkpoint and set PU blockheight 2019-05-15 20:44:47 +02:00
TomZ 8d716cba28 Allow log path to be a dir
Allow logs.conf to supply the file-path as an (existing) directory which
will lead to the result of opening the standard filename in that dir.
2019-05-08 17:04:09 +02:00
TomZ 26747573f7 Import protocol version numbers 2019-05-08 10:53:18 +02:00
TomZ e137a7b59f Add simple memcpy constructor to KeyId / uint160 2019-05-06 14:45:12 +02:00
TomZ a7f9b9fed5 Remove obsolete code.
Remove txIndex option, its move to Flowee Indexer

Also remove the GUI option for setting the amount
of "script validator threads". :D

Remove DBCash command line option too, equally obsolete.
2019-04-22 21:16:10 +02:00
TomZ d20dd6d70a Cleanup; block-pruning
This has been commented out code for some time and its probably best to
remove dead code so as to avoid it rotting.
2019-04-22 20:33:49 +02:00
TomZ 2577b6f7ef Merge branch 'may19PU' 2019-04-22 12:51:07 +02:00
TomZ b0eb502688 Make start date configurable
introducing: -hf201905-activationtime
2019-04-21 17:45:40 +02:00
TomZ 2b0260bdf5 fix unneeded space after exception log message 2019-04-21 17:32:41 +02:00
TomZ e0b18781fd Downgrade NET warnings to infos 2019-04-21 17:31:39 +02:00
TomZ b41e2795e7 Add Schnorr support 2019-04-19 17:30:59 +02:00
TomZ 86a59c067d Add support for the 'segwit recovery' 2019-04-19 17:30:56 +02:00
TomZ ed7ca33d6a Add decoding and printing addresses work.
This now supports cashaddress, legacy addresses and it prints
basic info about the usages of said address.
2019-04-11 18:45:28 +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