Commit graph

275 commits

Author SHA1 Message Date
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
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
Steven Roose
fbe1bfa659 server: print full name of cf index in main log 2018-07-06 14:40:27 -05:00
Jim Posen
4d0e856ea1 server: Handler for getcfcheckpt messages. 2018-05-23 16:46:15 -07:00
Jim Posen
4c991c8783 wire: Populate cfheaders message with filter hashes instead of headers. 2018-05-23 16:46:15 -07:00
Jim Posen
175af18043 multi: Modify CFHeaders message to have a PrevFilterHeader field. 2018-05-23 16:46:15 -07:00
Jim Posen
7a53a05878 multi: Redefine GetCFHeaders to have StartHeight and StopHash. 2018-05-23 16:46:15 -07:00
Jim Posen
daac60675e multi: Redefine GetCFilters to have StartHeight and StopHash. 2018-05-23 16:46:15 -07:00
Jim Posen
621f347929 wire: Remove cftypes and getcftypes commands. 2018-05-23 16:46:15 -07:00
Olaoluwa Osuntokun
5291c455c2 server: properly set feeEstimator in newServer 2018-05-23 16:46:15 -07:00
Daniel Krawisz
47113d428c It is now possible to save and restore the state of the FeeEstimator
and the server searches the database for a previous state to load
when the program is turned on.
2018-05-23 16:46:15 -07:00
Daniel Krawisz
4fd446028f Enable estimatefee rpc command. 2018-05-23 16:46:15 -07:00
Daniel Krawisz
1333ad7f78 FeeEstimator added to server. Mempool alerts the fee estimator of
new txs that it observes. The block manager alerts the fee estimator
of new and orphaned blocks.

Check for invalid state and recreate FeeEstimator if necessary.
2018-05-23 16:46:15 -07:00
Olaoluwa Osuntokun
10432160d5 multi: rebase to upstream, update API's 2018-05-23 16:46:15 -07:00
Alex
e0a357abb5 server: add TODO for querying supported filter types 2018-05-23 16:46:15 -07:00
Alex
c7e7acc7fd multi: use hidden varint for cftypes count; make filter type enum, not uint8 2018-05-23 16:46:15 -07:00
Alex
5772bdde86 server: add OnGetCFTypes callback to serverPeer 2018-05-23 16:46:15 -07:00
Alex
621c73dad1 multi: change cfilter Extended bool to FilterType uint8
The cfilter BIP specifies that the filter type is a uint8. The
current code encodes it correctly on the wire, but everywhere else,
it's treated as a boolean (false for basic filter, true for
extended). This commit corrects that to account for possible
additional filter types in the future. All package changes are
done in one commit as they're all interdependent. The following
packages are updated:

* blockchain/indexers
* btcjson
* peer
* wire
* main (server.go and rpcserver.go)
2018-05-23 16:46:15 -07:00
Alex
c5c392c5c5 server: init rpcserver with cfindex 2018-05-23 16:46:15 -07:00
Alex
6589cffb19 server: change logging in OnGetCFilter to be less verbose 2018-05-23 16:46:15 -07:00
Alex
92f1de6dd9 Fix case where 0 headers are retrieved. 2018-05-23 16:46:15 -07:00
Alex
dabb8000fb Add Extended flag to cfilter and cfheaders messages 2018-05-23 16:46:15 -07:00
Alex
936caad9c2 Add last blockhash to cfheaders and blockhash to cfilter messages 2018-05-23 16:46:15 -07:00
Alex
ba4a2f77a5 wire/server: allocate hash once per loop to prevent overwriting 2018-05-23 16:46:15 -07:00
Alex
29b5ece196 Changed getcfheaders/cfheaders messages to get multiple headers. 2018-05-23 16:46:15 -07:00
Alex
8ad7aa5d5d Rename CFilterHeader to CFHeader on P2P side; fix some bugs/tests 2018-05-23 16:46:15 -07:00
pedro martelletto
b8c3be740f Add CFilterHeader p2p counterparts 2018-05-23 16:46:15 -07:00
Alex
6102e129c5 Fixed a couple of bugs and added --dropcfindex option 2018-05-23 16:46:15 -07:00
pedro martelletto
cdb3d44fa8 p2p needs a new message to return committed filters 2018-05-23 16:46:15 -07:00
pedro martelletto
71c421db66 Differentiate between basic/extended filters in p2p/RPC 2018-05-23 16:46:15 -07:00
pedro martelletto
396d28955c better separation between filters; comments 2018-05-23 16:46:15 -07:00
pedro martelletto
6e5f650be9 CBFilter -> CFilter, discussed with davec@ 2018-05-23 16:46:15 -07:00
pedro martelletto
a77b1e00d5 FilterByBlockHash(), pointed out by davec@ 2018-05-23 16:46:15 -07:00
pedro martelletto
43bf8db793 Look up filters from p2p GetCBF message 2018-05-23 16:46:15 -07:00
pedro martelletto
3b0038093a Hook CBF indexer to server code 2018-05-23 16:46:15 -07:00
pedro martelletto
b2990e7999 Move filter generating code to CBF indexer 2018-05-23 16:46:15 -07:00
pedro martelletto
c8627cbee4 Use a harcoded key to generate filters
Pointed out by alex@. Using a dummy key for now.
2018-05-23 16:46:15 -07:00
pedro martelletto
dc25da8296 Generate a filter for a given block 2018-05-23 16:46:15 -07:00
pedro martelletto
e9298934b9 Add a stub GetCBFilter message.
Actual semantic and payload format yet to be defined.
2018-05-23 16:46:15 -07:00
pedro martelletto
333af136ef Create a knob to switch CBFs off.
While having them on by default. We may want to revisit this and
make no CBFs the default.
2018-05-23 16:46:15 -07:00
Olaoluwa Osuntokun
2842f933bb server: fix linter error 2018-05-15 20:47:29 -07:00
Nicola 'tekNico' Larosa
11fcd83963 btcd/multi: fix a number of typos in comments. 2018-01-25 23:23:59 -06:00
Dave Collins
8c883d1fca
blockchain/indexers: Allow interrupts.
This propagates the interrupt channel through to blockchain and the
indexers so that it is possible to interrupt long-running operations
such as catching up indexes.
2017-09-05 11:02:46 -05:00
Jim Posen
30d4caeac6 server: Simplify logic to bind listeners.
The helper function parseListeners has been changed to return a
slice of net.Addrs with Network() returning tcp4 or tcp6 instead of
returning two slices of IPv4 and IPv6 addresses to simplify calling
code. Also improves how local addresses are added to the address
manager when listening on wildcard addresses.

Also splits some newServer logic into new method initListeners.
2017-09-04 11:55:37 -07:00
David Hill
a2085c68f8 config: Add --whitelist support. 2017-08-31 09:59:43 -04:00
Dave Collins
9bd7bcfff6
travis: Update to go 1.8 and 1.9.
Also, make the gosimple linter happy while here.
2017-08-30 01:03:26 -05:00
Andy Weidenbaum
a1d1ea70dd rm extra word segwit, s/segwit segwit/segwit 2017-08-26 10:56:46 -07:00
Jim Posen
46fd4ec358 netsync: Change name of blockManager to syncManager. 2017-08-25 13:41:22 -05:00
Dave Collins
34b1373a68
blockchain: Refactor inv discovery for chain view.
This refactors the code that locates blocks (inventory discovery) out of
server and into blockchain where it can make use of the new much more
efficient chain view and more easily be tested.  As an aside, it really
belongs in blockchain anyways since it's purely dealing with the block
index and best chain.

Since the majority of the network has moved to header-based semantics,
this also provides an additional optimization to allow headers to be
located directly versus needing to first discover the hashes and then
fetch the headers.

The new functions are named LocateBlocks and LocateHeaders.  The former
returns a slice of located hashes and the latter returns a slice of
located headers.

Finally, it also updates the RPC server getheaders call and related
plumbing to use the new LocateHeaders function.

A comprehensive suite of tests is provided to ensure both functions
behave correctly for both correct and incorrect block locators.
2017-08-24 14:15:34 -05:00