Skip to content

Commit

Permalink
Merge pull request #265 from Roasbeef/cache-module
Browse files Browse the repository at this point in the history
cache+neutrino: add new cache module (no tag yet)
  • Loading branch information
Roasbeef authored Feb 11, 2023
2 parents 88d8515 + 7c57710 commit 1d7404f
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 39 deletions.
16 changes: 8 additions & 8 deletions blockmanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -1625,14 +1625,14 @@ func (b *blockManager) detectBadPeers(headers map[string]*wire.MsgCFHeaders,
//
// We'll use a few strategies to figure out which peers we believe serve
// invalid filters:
// 1. If a peers' filter doesn't match on a script that must match, we know
// the filter is invalid.
// 2. If a peers' filter matches on a script that _should not_ match, it
// is potentially invalid. In this case we ban peers that matches more
// such scripts than other peers.
// 3. If we cannot detect which filters are invalid from the block
// contents, we ban peers serving filters different from the majority of
// peers.
// 1. If a peers' filter doesn't match on a script that must match, we know
// the filter is invalid.
// 2. If a peers' filter matches on a script that _should not_ match, it
// is potentially invalid. In this case we ban peers that matches more
// such scripts than other peers.
// 3. If we cannot detect which filters are invalid from the block
// contents, we ban peers serving filters different from the majority of
// peers.
func resolveFilterMismatchFromBlock(block *wire.MsgBlock,
fType wire.FilterType, filtersFromPeers map[string]*gcs.Filter,
threshold int) ([]string, error) {
Expand Down
3 changes: 3 additions & 0 deletions cache/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module github.com/lightninglabs/neutrino/cache

go 1.19
14 changes: 7 additions & 7 deletions cache/cache_test.go → cache_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cache_test
package neutrino

import (
"crypto/rand"
Expand Down Expand Up @@ -55,9 +55,9 @@ func TestBlockFilterCaches(t *testing.T) {
filters = append(filters, filter)

// Put the generated filter in the filter caches.
cacheKey := cache.FilterCacheKey{blockHash, filterType}
cacheKey := FilterCacheKey{blockHash, filterType}
for _, c := range filterCaches {
_, _ = c.Put(cacheKey, &cache.CacheableFilter{Filter: filter})
_, _ = c.Put(cacheKey, &CacheableFilter{Filter: filter})
}

msgBlock := &wire.MsgBlock{}
Expand All @@ -70,7 +70,7 @@ func TestBlockFilterCaches(t *testing.T) {
wire.InvTypeWitnessBlock, &blockHash,
)
for _, c := range blockCaches {
_, _ = c.Put(*blockKey, &cache.CacheableBlock{block})
_, _ = c.Put(*blockKey, &CacheableBlock{block})
}
}

Expand All @@ -80,15 +80,15 @@ func TestBlockFilterCaches(t *testing.T) {
blockHash := blockHash

// Check filter caches.
cacheKey := cache.FilterCacheKey{blockHash, filterType}
cacheKey := FilterCacheKey{blockHash, filterType}
for _, c := range filterCaches {
e, err := c.Get(cacheKey)
if err != nil {
t.Fatalf("Unable to get filter: %v", err)
}

// Ensure we got the correct filter.
filter := e.(*cache.CacheableFilter).Filter
filter := e.(*CacheableFilter).Filter
if filter != filters[i] {
t.Fatalf("Filters not equal: %v vs %v ",
filter, filters[i])
Expand All @@ -106,7 +106,7 @@ func TestBlockFilterCaches(t *testing.T) {
}

// Ensure it is the same block.
block := b.(*cache.CacheableBlock).Block
block := b.(*CacheableBlock).Block
if block != blocks[i] {
t.Fatalf("Not equal: %v vs %v ",
block, blocks[i])
Expand Down
2 changes: 1 addition & 1 deletion cache/cacheable_block.go → cacheable_block.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cache
package neutrino

import "github.com/btcsuite/btcd/btcutil"

Expand Down
2 changes: 1 addition & 1 deletion cache/cacheable_filter.go → cacheable_filter.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cache
package neutrino

import (
"github.com/btcsuite/btcd/btcutil/gcs"
Expand Down
24 changes: 23 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,30 @@ require (
github.com/btcsuite/btcwallet/walletdb v1.3.5
github.com/btcsuite/btcwallet/wtxmgr v1.5.0
github.com/davecgh/go-spew v1.1.1
github.com/lightninglabs/neutrino/cache v0.0.0-00010101000000-000000000000
github.com/lightningnetwork/lnd/queue v1.0.1
github.com/stretchr/testify v1.7.0
)

go 1.13
require (
github.com/aead/siphash v1.0.1 // indirect
github.com/btcsuite/btcwallet/wallet/txrules v1.2.0 // indirect
github.com/btcsuite/btcwallet/wallet/txsizes v1.1.0 // indirect
github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd // indirect
github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792 // indirect
github.com/decred/dcrd/crypto/blake256 v1.0.0 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect
github.com/decred/dcrd/lru v1.0.0 // indirect
github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23 // indirect
github.com/lightningnetwork/lnd/clock v1.0.1 // indirect
github.com/lightningnetwork/lnd/ticker v1.0.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
go.etcd.io/bbolt v1.3.5-0.20200615073812-232d8fc87f50 // indirect
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 // indirect
golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed // indirect
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect
)

go 1.18

replace github.com/lightninglabs/neutrino/cache => ./cache
12 changes: 0 additions & 12 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -51,21 +51,18 @@ github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeC
github.com/decred/dcrd/lru v1.0.0 h1:Kbsb1SFDsIlaupWPwsPp+dkxiBY1frcS07PCPgotKz8=
github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0=
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM=
github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4=
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
Expand All @@ -84,17 +81,14 @@ github.com/lightningnetwork/lnd/queue v1.0.1 h1:jzJKcTy3Nj5lQrooJ3aaw9Lau3I0IwvQ
github.com/lightningnetwork/lnd/queue v1.0.1/go.mod h1:vaQwexir73flPW43Mrm7JOgJHmcEFBWWSl9HlyASoms=
github.com/lightningnetwork/lnd/ticker v1.0.0 h1:S1b60TEGoTtCe2A0yeB+ecoj/kkS4qpwh6l+AkQEZwU=
github.com/lightningnetwork/lnd/ticker v1.0.0/go.mod h1:iaLXJiVgI1sPANIF2qYYUJXjoksPNvGNYowB8aRbpX0=
github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78=
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk=
github.com/onsi/ginkgo v1.14.0 h1:2mOpI4JVVPBN+WQRa0WKH2eXR+Ey+uK4n7Zj0aYpIQA=
github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY=
github.com/onsi/gomega v1.4.1/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA=
github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
github.com/onsi/gomega v1.10.1 h1:o0+MgICZLuZ7xjH7Vx6zS/zcu93/BEp1VwkIW1mEXCE=
github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
Expand All @@ -116,7 +110,6 @@ golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73r
golang.org/x/net v0.0.0-20190206173232-65e2d4e15006/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc h1:zK/HqS5bZxDptfPJNq8v7vJfXtkU7r9TLIoSr1bXaP4=
golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
Expand All @@ -134,29 +127,24 @@ golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
google.golang.org/protobuf v1.23.0 h1:4MY060fB1DLGMB/7MBTLnwQUY6+F09GEiz6SsrNqyzM=
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU=
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
12 changes: 6 additions & 6 deletions query.go
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ checkResponses:
func (s *ChainService) getFilterFromCache(blockHash *chainhash.Hash,
filterType filterdb.FilterType) (*gcs.Filter, error) {

cacheKey := cache.FilterCacheKey{
cacheKey := FilterCacheKey{
BlockHash: *blockHash,
FilterType: filterType,
}
Expand All @@ -557,18 +557,18 @@ func (s *ChainService) getFilterFromCache(blockHash *chainhash.Hash,
return nil, err
}

return filterValue.(*cache.CacheableFilter).Filter, nil
return filterValue.(*CacheableFilter).Filter, nil
}

// putFilterToCache inserts a given filter in ChainService's FilterCache.
func (s *ChainService) putFilterToCache(blockHash *chainhash.Hash,
filterType filterdb.FilterType, filter *gcs.Filter) (bool, error) { // nolint:unparam

cacheKey := cache.FilterCacheKey{
cacheKey := FilterCacheKey{
BlockHash: *blockHash,
FilterType: filterType,
}
return s.FilterCache.Put(cacheKey, &cache.CacheableFilter{Filter: filter})
return s.FilterCache.Put(cacheKey, &CacheableFilter{Filter: filter})
}

// cfiltersQuery is a struct that holds all the information necessary to
Expand Down Expand Up @@ -982,7 +982,7 @@ func (s *ChainService) GetBlock(blockHash chainhash.Hash,
// If the block is already in the cache, we can return it immediately.
blockValue, err := s.BlockCache.Get(*inv)
if err == nil && blockValue != nil {
return blockValue.(*cache.CacheableBlock).Block, err
return blockValue.(*CacheableBlock).Block, err
}
if err != nil && err != cache.ErrElementNotFound {
return nil, err
Expand Down Expand Up @@ -1066,7 +1066,7 @@ func (s *ChainService) GetBlock(blockHash chainhash.Hash,
}

// Add block to the cache before returning it.
_, err = s.BlockCache.Put(*inv, &cache.CacheableBlock{Block: foundBlock})
_, err = s.BlockCache.Put(*inv, &CacheableBlock{Block: foundBlock})
if err != nil {
log.Warnf("couldn't write block to cache: %v", err)
}
Expand Down
5 changes: 2 additions & 3 deletions query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import (
"github.com/btcsuite/btcd/chaincfg"
"github.com/btcsuite/btcd/chaincfg/chainhash"
"github.com/btcsuite/btcd/wire"
"github.com/lightninglabs/neutrino/cache"
"github.com/lightninglabs/neutrino/cache/lru"
"github.com/lightninglabs/neutrino/filterdb"
"github.com/lightninglabs/neutrino/headerfs"
Expand Down Expand Up @@ -153,7 +152,7 @@ func genRandFilter(numElements uint32, t *testing.T) (
}

// Convert into CacheableFilter and compute Size.
c := &cache.CacheableFilter{Filter: filter}
c := &CacheableFilter{Filter: filter}
s, err := c.Size()
if err != nil {
t.Fatalf("unable to create random filter: %v", err)
Expand Down Expand Up @@ -267,7 +266,7 @@ func TestBlockCache(t *testing.T) {
}
headers.WriteHeaders(header)

sz, _ := (&cache.CacheableBlock{Block: b}).Size()
sz, _ := (&CacheableBlock{Block: b}).Size()
if i < len(blocks)/2 {
size += sz
}
Expand Down

0 comments on commit 1d7404f

Please sign in to comment.