Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new getcfilters message for utreexo nodes #197

Open
wants to merge 28 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
6418f02
add function to create headers for utreexo cf
alainjr10 Jul 23, 2024
cab02cc
add new filter type
alainjr10 Jul 23, 2024
1f938ff
add indexer for utreexoc filter
alainjr10 Jul 23, 2024
a3e6852
add func to serialize utreexo roots hash
alainjr10 Jul 23, 2024
001749f
handle new getcfilters and getcfheaders message type
alainjr10 Jul 23, 2024
f509bc8
add utreexocf command line params to config struct
alainjr10 Jul 23, 2024
afae8ca
add checks and error messages on trying to disable utreexocf index
alainjr10 Jul 23, 2024
5254208
update implementeation of getcfilter handler
alainjr10 Jul 23, 2024
f708806
fix: fix node panic on start
alainjr10 Jul 25, 2024
e7b1d55
add function to filter headers by blockhashes
alainjr10 Aug 4, 2024
04b6da9
handle on getcfcheckpt in server.go
alainjr10 Aug 4, 2024
5573d34
add filterheaderby block hash and improve other util funcs
alainjr10 Aug 4, 2024
5383c21
fetch hilter headers from proper location ongetcfheaders based on fil…
alainjr10 Aug 4, 2024
5939086
update handlegetcfilterheader to handle both supported cfilters
alainjr10 Aug 4, 2024
6394bbc
add comment for new utreexocfilter type
alainjr10 Aug 5, 2024
e74b647
adjust utreexoCFIndexName comment
alainjr10 Aug 5, 2024
16de187
indexers: make more appropriate comments
alainjr10 Aug 5, 2024
068bbea
indexer: init chain in utreexocfindex init
alainjr10 Aug 6, 2024
c6452a4
utreexod: update order of append indexers
alainjr10 Aug 6, 2024
0e9a41a
indexer: return empty utreexo stump if root is nil
alainjr10 Aug 8, 2024
e84894d
add missing return for absent utreexocfindex for pruned nodes
alainjr10 Aug 12, 2024
4585387
rpc: handle getutreexocfilter in different function
alainjr10 Aug 12, 2024
271fa62
wire: add sfnodeutreexocf flag
alainjr10 Aug 20, 2024
d0a1962
indexers: handle blocking dureing check for CSN
alainjr10 Aug 20, 2024
146a032
server: add check for sfnodeutreexocf flag
alainjr10 Aug 20, 2024
51df5ba
indexers: fix utreexocfilters not performing ibd
alainjr10 Aug 30, 2024
5ba9fbf
config: throw early error when noutreexo is passed along with utreexo…
alainjr10 Aug 30, 2024
5cb8c30
indexers: update fetchutreexoroots func to fetch proper roots for all…
alainjr10 Aug 30, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions blockchain/chainio.go
Original file line number Diff line number Diff line change
Expand Up @@ -1080,6 +1080,32 @@ func SerializeUtreexoRoots(numLeaves uint64, roots []utreexo.Hash) ([]byte, erro
return w.Bytes(), nil
}

// SerializeUtreexoRootsHash serializes the numLeaves and the roots into a byte slice.
// it takes in a slice of chainhash.Hash instead of utreexo.Hash. chainhash.Hash is the hashed
// value of the utreexo.Hash.
func SerializeUtreexoRootsHash(numLeaves uint64, roots []*chainhash.Hash) ([]byte, error) {
// 8 byte NumLeaves + (32 byte roots * len(roots))
w := bytes.NewBuffer(make([]byte, 0, 8+(len(roots)*chainhash.HashSize)))

// Write the NumLeaves first.
var buf [8]byte
byteOrder.PutUint64(buf[:], numLeaves)
_, err := w.Write(buf[:])
if err != nil {
return nil, err
}

// Then write the roots.
for _, root := range roots {
_, err = w.Write(root[:])
if err != nil {
return nil, err
}
}

return w.Bytes(), nil
}

// DeserializeUtreexoRoots deserializes the provided byte slice into numLeaves and roots.
func DeserializeUtreexoRoots(serializedUView []byte) (uint64, []utreexo.Hash, error) {
totalLen := len(serializedUView)
Expand Down
Loading