Commit graph

3113 commits

Author SHA1 Message Date
Olaoluwa Osuntokun
d81d8877b8
Merge pull request #1266 from cfromknecht/arm-siphash-fix
build: update siphash lib to latest version w/ ARM fix
2018-08-22 20:07:28 -07:00
Olaoluwa Osuntokun
e3a8d7fb29
Merge pull request #1265 from cfromknecht/fix-indexer-reorg
blockchain/indexers: fix bug in indexer re-org catch up
2018-08-22 20:07:08 -07:00
Olaoluwa Osuntokun
b36dce5032
build: update siphash lib to latest version w/ ARM fix
In this commit, we update the siphash lib we use to the latest version
as it was discovered that the assembly for certain ARM machines has a
flaw which causes it to compute an _incorrect_ siphash function. The
upstream lib has since disabled the assembly after this was discovered.
We update as well in order to ensure that ARM machines will produce the
proper GCS filters.
2018-08-22 19:58:59 -07:00
Olaoluwa Osuntokun
be191ca111
blockchain/indexers: fix bug in indexer re-org catch up
In this commit, we fix an existing bug in the re-org catch up logic for
the `IndexManager`. Before this commit, we would assign the block to the
_local_ scope rather than the outer scope. As a result, we would never
properly bisect the chain to find the fork point to be able to reconcile
the index state to the main chain only after a re-org occurs.

Fixes #1261
2018-08-22 19:46:27 -07:00
Olaoluwa Osuntokun
9d15e63c50
Merge pull request #1259 from cfromknecht/bhv-int64-confs
btcjson: use int64 for GetBlockHeader[Verbose] confirmations
2018-08-22 19:45:43 -07:00
Olaoluwa Osuntokun
9f436585d7
Merge pull request #1247 from davecgh/peer_minor_cleanup
peer: Minor function definition order cleanup.
2018-08-22 19:41:16 -07:00
Olaoluwa Osuntokun
8822e27134
Merge pull request #1223 from wpaulino/harness-disable-txindex
integration/rpctest: disable the txindex by default and allow sending txs without change outputs
2018-08-22 19:40:27 -07:00
Olaoluwa Osuntokun
bb912b6e03
Merge pull request #1222 from halseth/trickle-timeout
config/peer: make trickleTimeout configurable
2018-08-22 19:39:33 -07:00
Wilmer Paulino
dfd7f6caf8
integration/rpctest: add ability to create txs without change outputs 2018-08-16 16:24:02 -07:00
Wilmer Paulino
9aa83ad423
integration/rpctest: disable the txindex by default
In this commit, we disable the txindex by default as the flag cannot be
overwritten by btcd once set.
2018-08-16 16:24:01 -07:00
Conner Fromknecht
85cb8f50a0
rpcserver: convert verbose confirmations fields to int64 2018-08-15 21:05:34 -07:00
Conner Fromknecht
f696d49c49
btcjson/chainsvrresults: use int64 for verbose getblock[header] confs
This commit modifies the parsed fields in GetBlockVerbose
and GetBlockHeaderVerbose from a uint64 to an int64.
bitcoind will return -1 if the requested block is not in
the main chain, which causes a panic when trying to
serialize into a uint.
2018-08-15 21:02:33 -07:00
Dave Collins
fd78330fd3
peer: Minor function definition order cleanup.
This rearranges some of the function definitions that pertain to initial
peer version negotiation and bringup so they are more consistent with
the preferred order used throughout the codebase.  In particular, the
functions are defined before they're first used and generally as close
as possible to the first use when they're defined in the same file.

There are no functional changes.

Backported from Decred.
2018-08-10 20:20:11 -05:00
Olaoluwa Osuntokun
f899737d7f
Merge pull request #1169 from stevenroose/filteradd
server: Fix bug disconnecting peer on filteradd
2018-08-09 17:06:19 -07:00
Olaoluwa Osuntokun
0f95fff561
Merge pull request #1243 from Roasbeef/init-block-index-consistency
blockchain: in initChainState mark ancestors of best tip as valid if …
2018-08-09 17:02:37 -07:00
Olaoluwa Osuntokun
69f313436f
blockchain: during fastAdd or if block wasn't already valid, mark as valid in index 2018-08-09 16:57:01 -07:00
Olaoluwa Osuntokun
598808cfd0
blockchain: mark blocks as invalid if they fail connectBlock 2018-08-08 18:30:52 -07:00
Olaoluwa Osuntokun
f9722295f8
blockchain: add new flushIndexState function within connectBestChain 2018-08-08 18:26:34 -07:00
Olaoluwa Osuntokun
4b13e79691
blockchain: in initChainState mark ancestors of best tip as valid if not marked
In this commit, we add an additional consistency check within the
`initChainState` method.  It has been observed that at times, a block
wil lbe written to disk (as it's valid), but then the block index isn't
updated to reflect this. This can cause btcd to fail to do things like
serve cfheaders for valid blocks.

To partially remedy this, when we're loading in the index, we assume
that all ancestors of the current chain tip are valid, and mark them as
such. At the very end, we'll flush the index to ensure the state is
fully consistent. Typically this will be a noop, as only dirty elements
are flushed.
2018-08-08 17:50:00 -07:00
Olaoluwa Osuntokun
cf05f92c3f
Merge pull request #1236 from cfromknecht/backport-optimize-header-access
blockchain: Backport optimize exported header access.
2018-08-02 09:08:37 -07:00
Conner Fromknecht
f470bf0fe8
blockchain: Backport optimize exported header access.
backport of https://github.com/decred/dcrd/pull/1273

Notable difference being that btcd mainline currenlty
doesn't have a blockchain/blockindex_test.go file, so
those changes are omitted.

Great work @davecgh :)
2018-08-01 16:59:49 -07:00
Olaoluwa Osuntokun
f5e261fc9e
Merge pull request #1233 from cfromknecht/zeroheaders
server: always reply with get headers
2018-08-01 16:43:05 -07:00
Conner Fromknecht
90c2094cbd
server: always reply with get headers
backport of https://github.com/decred/dcrd/pull/1295
2018-07-31 21:15:02 -07:00
Johan T. Halseth
ee0740a289
peer test: set TrickleTimeout for test configs 2018-07-24 13:11:02 +02:00
Johan T. Halseth
08619220b4
config/peer: make trickleTimeout configurable 2018-07-24 12:59:44 +02:00
Olaoluwa Osuntokun
9a2f952402
Merge pull request #1228 from Roasbeef/fix-peer-goroutine-leak
peer: ensure the version negotiation goroutine will always exit
2018-07-21 19:02:38 -07:00
Olaoluwa Osuntokun
088eec67ec
peer: ensure the version negotiation goroutine will always exit
In this commit, we patch a goroutine leak within the peer struct. This
goroutine leak can happen, if the remote side fails to actually finish
negotiation the protocol before our timeout ticker ticks. In this case,
the goroutine will be blocked on a send, as the channel is unfired. An
example trace from a btcd node I had on testnet showed:
```
3183 @ 0x42e78a 0x42e83e 0x40540b 0x4051a5 0x872f76 0x45bfc1
```

So, all instances of the goroutine failing to exit due to the remote
peer not finishing the p2p version negotiation handshake.

Our fix is simple: make the `negotiateErr' channel unbuffered. With this
simple change, we ensure that the goroutine will always exit even in the
case that the parent goroutine exists due to a timeout.  # Please enter
the commit message for your changes. Lines starting
2018-07-21 17:41:23 -07:00
Olaoluwa Osuntokun
f673a4b563
Merge pull request #1215 from davecgh/blockchain_generalize_reorganizechain
blockchain: Generalize chain reorg.
2018-07-17 20:36:26 -07:00
Olaoluwa Osuntokun
bc3861a5a2
Merge pull request #1218 from wpaulino/filter-type-verification
server: ensure we only fetch filters we know of
2018-07-16 20:16:23 -07:00
Olaoluwa Osuntokun
5e86c37411
server: fix bug in cf checkpoint serving
In this commit, we fix a bug in the way that we previously attempted to
server cfcheckpoints. In the prior version we would never actually
fetch the current length of the cache. As a result, after the first time
the checkpoints were fetched, we would always continually grow the
cache rather than using what's there if sufficient.

In this commit, we fix this behavior by always checking the length, then
either keeping the rite lock, or downgrading to a read lock if the size
was sufficient.
2018-07-16 16:31:11 -07:00
Olaoluwa Osuntokun
f7366fb51b
server: ensure we only fetch filters we know of 2018-07-14 12:20:20 -07:00
Dave Collins
b091d71646
blockchain: Generalize chain reorg.
This generalizes the reorganizeChain function in the blockchain package
to allow it to rewind the chain in the case no attach nodes are provided
or extend the chain in the case no detach nodes are provided.

It also adds several assertions to ensure the assumptions about the
state hold and cleans up the handling of setting invalid ancestor nodes
in the case of a failed block validation.
2018-07-11 19:46:30 -05:00
Olaoluwa Osuntokun
fdfc19097e
Merge pull request #1211 from wpaulino/gcs-modifications
multi: update gcs indexing and serving code to match latest BIP 158 instance
2018-07-06 18:25:21 -05:00
Olaoluwa Osuntokun
21b0303341
wire: remove instances of the extended gcs filter 2018-07-06 16:15:25 -07:00
Olaoluwa Osuntokun
a05f62fabd
btcjson: remove instances of the extended gcs filter 2018-07-06 16:15:24 -07:00
Olaoluwa Osuntokun
298efd8359
blockchain/indexers: ensure the cfindex gets inputs 2018-07-06 16:15:24 -07:00
Olaoluwa Osuntokun
102ca293f6
blockchain: pass in prevScript for constructing the basic filter 2018-07-06 16:15:24 -07:00
Olaoluwa Osuntokun
576800a99e
blockchain/indexer: remove extended filter 2018-07-06 16:15:23 -07:00
Olaoluwa Osuntokun
942116c5ae
rpc: remove extended fitler from help 2018-07-06 16:15:23 -07:00
Olaoluwa Osuntokun
66d632f32e
wire: remove the extended filter 2018-07-06 16:15:23 -07:00
Olaoluwa Osuntokun
28d4261c2d build: update glide for btcutil w/ latest BIP 158 2018-07-06 16:08:15 -07:00
Olaoluwa Osuntokun
991d32e72f
Merge pull request #1210 from wpaulino/indexing-use-spend-journal
blockchain: modify indexers to use the stxo set for a block rather than the utxo set
2018-07-06 17:02:24 -05:00
Wilmer Paulino
1d99af29c7
btcjson: fix formatting directives 2018-07-06 13:06:00 -07:00
Tzu-Jung Lee
98769ddbdf docs: Update example links in README 2018-07-06 14:41:20 -05:00
Steven Roose
fbe1bfa659 server: print full name of cf index in main log 2018-07-06 14:40:27 -05:00
Olaoluwa Osuntokun
c32d30c567
Merge pull request #1193 from cfromknecht/btcec-decompression-fix
btcec: verify square root during point decompression
2018-07-06 14:39:47 -05:00
Conner Fromknecht
347cd3839f
btcec/signature_test: adds small pubkey recovery tests 2018-06-12 17:31:03 -07:00
Olaoluwa Osuntokun
a26e2634fa
blockchain/indexers: update indexing to use stxos instead of utxo view for blocks
In this commit, we update all the indexers to use the stxo set for a
particular block rather than the utxo view for the block. We do this as
we can eliminate a large number of random reads for each block, and can
instead deserialize a single instance of all the outputs spent in that
block and feed in the prev input scripts to each indexer.
2018-05-30 20:47:40 -07:00
Olaoluwa Osuntokun
ad69a7121b blockchain: update IndexManager interface to use spent txos
In this commit, we update the IndexManager interface to use spent txos
rather than the unspent output set for a particualr block. We do this in
order to improve the performance of the current address index which
requires reconstructing the utxo view from the PoV of that new block. In
practice, this is very slow as we need to perform a series of random
reads in order to reconstruct the utxo set. Instead, we can use the set
of SpentTxOut's for that block as this already contains the previous
output scripts which is what all of the current indexers really need.
2018-05-30 20:46:12 -07:00
Olaoluwa Osuntokun
e4d82bd6e2 blockchain: publicly export spentTxOut and all attributes
In this commit, we publicly export the spentTxOut struct and all its
attributes. This is the first in a set of commits to optimize the
existing address index by using the spend journal rather than manually
re-creating the utxoViewPoint each time.
2018-05-30 20:46:12 -07:00