Commit Graph

801 Commits

Author SHA1 Message Date
TomZ 1aacb3ae52 Vastly simplify mempool-acceptance
This removes the attempt at magic (predicting future) component
called the fee-estimator.
The direct effect is that all transactions have as a mempool acceptance
the same minimum fee. Regardless of how full the mempool or blocks were.

This mempool-acceptance minimum fee is 0 sat/byte. (aka free)

Notice the node-wide free-tx accept-limiter is going to avoid us getting
overloaded.
2019-06-28 14:02:11 +02:00
TomZ 896f5e7b68 Merge branch 'master' into MessageBuilder::Reply 2019-06-26 22:20:44 +02:00
TomZ 98b3e7cece use new MessageBuilder::reply() 2019-06-26 22:19:28 +02:00
TomZ 39428f1271 Cleanup the logging at shutdown.
The RPC / HTTP servers were logging about being shutdown even if
they never were started in the first place. This confused people.
Also removed some empty methods.
2019-06-24 21:18:01 +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 cf4eca26ba Merge branch '2019.06' 2019-06-22 13:02:11 +02:00
TomZ 21ce0163f7 Fix possible threading issue, use an atomic
The changecount integer was updated in two different threads,
so it needs to be an atomic to be safe.
2019-06-22 12:37:01 +02:00
TomZ a56b67caf2 NWM; Create a new socket before reconnect 2019-06-22 10:59:47 +02:00
TomZ 49b6f802a5 Make loglines less confusing
Now multiple different targets use this database, the messages
were confusing. Next to that "pruning" is not really correct
and it lead to confusing. More correct is the term GC.
2019-06-22 10:59:37 +02:00
TomZ 9ee38a2633 Merge branch '2019.06' 2019-06-19 22:47:56 +02:00
TomZ ba213cfe9d Fix optimisation.
It incorrectly assumed all transactions were coinbases.
2019-06-19 22:45:44 +02:00
TomZ c0752a944c Fix sometimes not being able to load a UTXO
In the rare case when we already created a new DB file, but never
managed to write a .info file, the constructor would end up rejecting
the whole DB.
This just drops off the last useless file and goes from there.
2019-06-19 21:49:04 +02:00
TomZ 110d7e8a39 Fix pruning of rather large files 2019-06-19 16:55:59 +02:00
TomZ 75b394e94b Various little fixes
* user selected nodes (using -connect=) are whitelisted, which allows
them to get your headers even if you are still in initial download.
* Avoid crash in a starting node in isInInitialDownload when
pIndexBestHeader was still null.
2019-06-17 22:07:17 +02:00
TomZ 9eb3814103 Stabilize new API 2019-06-17 20:50:17 +02:00
TomZ 499db27a61 Fix parameter interaction blockmaxsize->maxmempool 2019-06-16 23:04:15 +02:00
TomZ 4bba0f0666 Remove dead code. 2019-06-16 23:04:14 +02:00
TomZ 174e9b55dd Make regtest generate() create min 100bytes txs.
The rule that transactions need to be at least 100bytes was honoured for
normal mining already.
Now unit tests and txVulcano which call RPC 'generate' will also comply.
2019-06-16 23:04:14 +02:00
TomZ 4a4a61aeed Add unit test for GetTransaction
This also includes a little blockchain of 114 blocks (the first 100 just
coinbase to reach coin-maturity) with transactions generated by the
txVulcano. So lots of outputs.

I adjusted the BlackBoxTest to load this data into any hub with ease.
2019-06-16 23:04:14 +02:00
TomZ 5ca03cddd5 Futher improve how often save is called
Realize that the changes made before committing are changes I'm
not allowed to save yet and as such move scheduling to the commit()
method.
2019-06-15 21:36:52 +02:00
TomZ d5750426f4 Avoid sending too much 2019-06-15 19:57:35 +02:00
TomZ 1c27a291d0 Add a way for GetTransaction to only return certain outputs 2019-06-15 16:19:27 +02:00
TomZ 2b8e71a2ee Replace some left over BTC instances with BCH 2019-06-15 16:19:27 +02:00
TomZ 0a6146cde2 Reverse sign 2019-06-13 21:47:23 +02:00
TomZ e022e182c7 remove dead seeds and add ABC seed 2019-06-13 21:35:46 +02:00
TomZ fca434b1a6 Make Indexer connect to Hub after loading the conf
Doing it before could lead to incoming data being
processed before the SQL database connection was setup.
2019-06-13 17:12:28 +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 2eba51c5c6 Check message size in debug builds.
Double check our message-calculation is proper by checking the result.
Notice that asserts and logDebug both are turned off in release builds,
so this is just added to debug builds.
2019-06-13 12:30:20 +02:00
TomZ e5233fba32 On close, reset the chunked internal data. 2019-06-13 12:21:38 +02:00
TomZ 9f78e93879 Fix recusive calls
Without a recusive mutex recursive calls are not a fun idea.
2019-06-13 00:39:36 +02:00
TomZ 230611b98e Tweak the numbers to be better on IBD 2019-06-12 23:53:24 +02:00
TomZ 10efdada98 whitespace 2019-06-12 21:02:56 +02:00
TomZ 412f8b2ecf Fix possible corruption on reorgs 2019-06-12 21:02:56 +02:00
TomZ 4b96a30279 Use the chain, not the header for the API 2019-06-11 21:15:23 +02:00
TomZ 840cd5a913 Fix change-counting and saving in UTXO
Fix a bug that could make the wait between saves too long and now aim to
make the saving more often because this helps us determine in time that
the file is full so we don't go over the end.
2019-06-11 18:59:51 +02:00
TomZ 3fcd3536ed Clarify coinbase pos in block.
The first field after the header is the number of transactions. This
is a variable-width field of between 1 and 9 bytes.
Coinbase starts after that.
2019-06-11 17:38:30 +02:00
TomZ a310a529ce API cleanup; don't send prevtxhash for coinbases
The prevTxHash and prevOutIndex are irrelevant for coinbases as
the input isn't really an input.
2019-06-11 17:38:30 +02:00
TomZ 9e69a3fef9 Add new indexer; spentoutput
where the UTXO allows you to find an output based on txid+output, the
spentoutput DB turns that around and allows you to find an input that
spends a certain output.

This also fits perfectly find into the UTXO database class, so this
creates a new dir "spent" which is filled as expected.
2019-06-11 17:38:30 +02:00
TomZ 8e7e3b24ae Merge branch 'master' into httpengine 2019-06-10 21:27:46 +02:00
TomZ f9b01e2040 Fixlet in API docs 2019-06-10 21:02:15 +02:00
TomZ 2822b4ed4a Make API handling more robust. 2019-06-10 21:02:15 +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 ae6fb56654 Merge branch 'master' into httpengine 2019-06-07 09:57:11 +02:00
TomZ e168e3904d Respond to error. 2019-06-07 09:53:05 +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 a7f4e942f9 Add README for indexer 2019-06-06 20:15:01 +02:00
TomZ ec2610139e Allow setting indexer connections in conf file
This adds the ability to read from the config file the network
connections. Both the listening address and port as well as the upstream
'hub' address.
2019-06-06 19:44:16 +02:00
TomZ 01641773e1 Import httpengine library
This C++ library is a small framework which creates a full
http(s) server.

This is imported code from the qhttpengine open source project.
I modified some core components in order to make this framework
multi-threading and changed some APIs for cleanlyness. As such
it is not source compatible and getting it accepted upstream is
not realistic.
2019-06-04 21:41:26 +02:00