Commit graph

267 commits

Author SHA1 Message Date
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
Jim Posen 08955805d5 blockmanager: Remove serverPeer from blockmanager completely.
The purpose is to remove the dependency of blockmanager on serverPeer,
which is defined in the main package. Instead, we split out some of
the fields from serverPeer into a separate struct called peerSyncState
in blockmanager.go. While they are in the same package now, this
change makes it easier to move blockManager into its own package along
with peerSyncState. The blockManager tracks a map of Peer pointers to
the peer state and keeps it updated as peers connect and disconnect.
2017-08-23 10:02:12 -07:00
Jim Posen 088ccfd828 blockmanager: Remove dependency on cfg in main package. 2017-08-23 11:45:25 -05:00
Jim Posen 28606122c3 main: Reduce shared state between server and blockManager.
Instead of having both server and blockManager be aware of the
txProcessed and blockProcessed channels, now the server passed them as
method arguments to blockProcessor.
2017-08-15 15:41:59 -05:00
Jim Posen 095bba1a25 peer: Move IsWitnessEnabled() from serverPeer to Peer.
serverPeer is a problematic struct because it is local to the main
package.
2017-08-15 11:34:17 -07:00
Dave Collins c5c46376ba
rpcserver: Refactor listener logic to server.
This refactors the RPC server to accept and take ownership of already
configured listeners and refactors the logic to setup those listeners to
the server.  This mirrors the logic used by the connection manager and
is desirable since it is another step closer to being able to split the
RPC server code out into a separate package and will make it much easier
to internally test since it allows creating mock listeners.
2017-08-15 01:07:38 -05:00
Dave Collins a7a1029445
rpcserver: Decouple from server.
This decouples the RPC server from the internal btcd server to move
closer to being able to split it out into a separate package.

In order to accomplish this, it introduces an rpcserverConfig type and
several new interfaces, named rpcserverPeer, rpcserverConnManager, and
rpcserverBlockManager, which are necessary to break the direct
dependencies on the main server and block manager instances.

It also adds concrete implementations of the new interfaces and uses
them to configure the RPC server.

Ultimately, the RPC server should ideally be decoupled even more such
that all of the types in the configuration struct use interfaces instead
of the concrete types.  Doing this would make the RPC server much easier
to internally test since it would allow creating lightweight stubs for
the various pieces.
2017-08-14 23:01:07 -05:00
Jim Posen b71d6c3010 Create blockManagerConfig struct passed to newBlockManager.
The config struct accepts an instance of server as an implementation
of the new PeerNotifier wrapping interface.
2017-08-14 20:19:02 -07:00
Jim Posen 49949d4c96 Remove references from blockManager to rpcServer.
Instead of having the block manager notify the RPC server about
accepted, connected, and disconnected blocks, the RPC server will
directly listen for notifications from the blockchain.
2017-08-14 20:14:42 -07:00