Commit graph

165 commits

Author SHA1 Message Date
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
Olaoluwa Osuntokun
3d1caa2f83 multi: update to point to roasbeef forks 2018-05-23 16:46:15 -07:00
Olaoluwa Osuntokun
9b9ef42f8a blockchain/indexers: proper handling of empty filters 2018-05-23 16:46:15 -07:00
Olaoluwa Osuntokun
e0943a84bd blockchain/indexers: add a bit more line spacing to cfindex.go 2018-05-23 16:46:15 -07:00
Alex
1c5f25bbf2 blockchain/cfindex: Factor out filter/header calc. 2018-05-23 16:46:15 -07:00
Alex
860100019f blockchain: fix --dropcfindex 2018-05-23 16:46:15 -07:00
Alex
ba7b5f3308 Use NBytes() instead of Bytes() in CFIndex 2018-05-23 16:46:15 -07:00
Alex
9780ef5997 Skip TxIn on coinbase transaction when indexing 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
a5bf8941d5 Define FilterHeaderByBlockHash() 2018-05-23 16:46:15 -07:00
pedro martelletto
e620538343 Generate and store filter headers 2018-05-23 16:46:15 -07:00
pedro martelletto
b53c42f5dc Define dbFetch{Basic,Extended}Header() 2018-05-23 16:46:15 -07:00
pedro martelletto
7673859108 Create db buckets for committed filter hashes 2018-05-23 16:46:15 -07:00
pedro martelletto
ddfaed7f6f Delete extended filters in DisconnectBlock() 2018-05-23 16:46:15 -07:00
pedro martelletto
0a841fefcf Generate and store extended filters in ConnectBlock() 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
f703e18652 Populate filter #1 (extended) 2018-05-23 16:46:15 -07:00
pedro martelletto
f16da156c9 Include data pushes from pkscripts 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
57995fd111 Start preparing the ground for layer {0,1} filters 2018-05-23 16:46:15 -07:00
pedro martelletto
472141f88d Switch to new GCS builder interface 2018-05-23 16:46:15 -07:00
pedro martelletto
6d6677b797 zap errCFEntry 2018-05-23 16:46:15 -07:00
pedro martelletto
92c8ec4094 cbfindex.go -> cfindex.go 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
9f02951b0e CloneBytes() -> [:], pointed out by davec@ 2018-05-23 16:46:15 -07:00
pedro martelletto
8b8c7bcf05 Implement DisconnectBlock() for the CBF Indexer 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
76926f8904 Roll in a dbFetchCBFIndexEntry() 2018-05-23 16:46:15 -07:00
pedro martelletto
9809f4ffdd Instrument basic logging 2018-05-23 16:46:15 -07:00
pedro martelletto
cf74c8c3ca Abstract filter generation to a separate function 2018-05-23 16:46:15 -07:00
pedro martelletto
05d2fdeb11 Rename a variable in CBF's ConnectBlock() 2018-05-23 16:46:15 -07:00
pedro martelletto
620ad5b6fb Store filter in a db block index 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
95cbe2a911 Add the skeleton of a CBF indexer 2018-05-23 16:46:15 -07:00
Jim Posen
0ef0d8c59b blockchain: Initialize database with genesis block.
This fixes a bug introduced by #1066.
2018-02-09 11:34:30 -05:00
Alex Manuskin
50de9da05b blockchain: Fix typo in example_test.go. 2018-01-31 02:40:46 -06:00
Jim Posen
9aa9e79ebf blockchain: Enhance migration to v2 block index bucket.
This updates the block index migration to also store entries with
valid status bytes.
2018-01-28 23:34:56 -06:00
Jim Posen
52cddc19cd blockchain: Persist block status changes to disk.
The block index now tracks the set of dirty block nodes with status
changes that haven't been persisted and flushes the changes to the DB
at the appropriate times.
2018-01-28 23:34:56 -06:00
Jim Posen
31444f5890 blockchain: Add parent to blockNode constructor. 2018-01-28 23:34:56 -06:00
Jim Posen
a4d22d8384 blockchain: Delete block headers from old block index bucket.
As part of the migration to the new block index bucket, also delete
the redundant data from the old bucket.
2018-01-28 23:34:56 -06:00
Jim Posen
74fb6e56da blockchain: Database migration to populate block index bucket.
This creates a migration function that populates the block index
bucket using data from the ffldb block index bucket if it does not
exist.
2018-01-28 23:34:56 -06:00
Jim Posen
6315cea70c blockchain: Load all block headers into block index on init.
Currently only the blocks in the active chain are loaded into the
block index on initialization. This instead iterates over the entire
block index bucket in LevelDB and loads all nodes.
2018-01-28 23:34:56 -06:00
Jim Posen
175fd940bb blockchain: Store block headers in bucket managed by chainio.
The bucket contains block headers keyed by the block height encoded as
big-endian concatenated with the block hash. This allows block headers
to be fetched from the DB in height order with a cursor.
2018-01-28 23:34:56 -06:00
Nicola 'tekNico' Larosa
11fcd83963 btcd/multi: fix a number of typos in comments. 2018-01-25 23:23:59 -06:00
Mitchell Paull
f22a07b6cf blockchain: Fix typos in README.md. 2018-01-25 22:40:42 -06:00
Jim Posen
c7588cbf76 blockchain: NodeStatus & Set/UnsetStatusFlags methods on blockIndex.
These method allows safe concurrent access to reading and modifying
block node statuses. When block statuses get persisted in a later
change, the setter methods can be used to mark block nodes as dirty.
2017-10-23 04:33:15 -05:00
Jim Posen
e1ef2f899b blockchain: Track block validation status in block index.
Each node in the block index records some flags about its validation
state. This is just stored in memory for now, but can save effort if
attempting to reconnect a block that failed validation or was
disconnected.
2017-10-23 04:33:15 -05:00
Jim Posen
64d60f2ef2 blockchain: Remove BFDryRun behaviour flag.
This was only used to test block proposals, which has been changed to
instead use CheckConnectBlockTemplate. The flag complicated the
implementation of some chain processing routines and would be
difficult to implement with headers-first syncing.
2017-10-12 06:07:46 -05:00
Jim Posen
04444c1d0e blockchain: Use CheckConnectBlockTemplate for RPC block proposals.
This renames CheckConnectBlock to CheckConnectBlockTemplate and
modifies it to be easily consumable by the getblocktemplate RPC
handler. Performs full block validation now instead of partial
validation.
2017-10-12 06:07:46 -05:00