mirror of
https://github.com/QuilibriumNetwork/ceremonyclient.git
synced 2026-02-21 10:27:26 +08:00
raise degree of commit, force early commit on start
This commit is contained in:
parent
40a94b1863
commit
158d17d923
@ -104,10 +104,10 @@ func (n *LazyVectorCommitmentBranchNode) Commit(
|
||||
vector := make([][]byte, len(n.Children))
|
||||
wg := sync.WaitGroup{}
|
||||
workers := 1
|
||||
if n.LongestBranch <= 3 {
|
||||
if n.LongestBranch <= 4 {
|
||||
workers = runtime.WorkerCount(0, false)
|
||||
}
|
||||
if n.LongestBranch > 3 {
|
||||
if n.LongestBranch > 4 {
|
||||
fmt.Printf("DEBUG: Performing commit under %v path, leaves: %d\n", path, n.LeafCount)
|
||||
}
|
||||
throttle := make(chan struct{}, workers)
|
||||
|
||||
@ -446,6 +446,12 @@ func NewTokenExecutionEngine(
|
||||
e.pubSub.Subscribe(hypersyncMetadataFilter, e.handleMetadataMessage)
|
||||
e.wg.Add(1)
|
||||
go e.runMetadataMessageHandler()
|
||||
for _, h := range e.hypergraph.Commit() {
|
||||
e.logger.Info(
|
||||
"current hypergraph commit",
|
||||
zap.String("root_commitment", hex.EncodeToString(h)),
|
||||
)
|
||||
}
|
||||
|
||||
protobufs.RegisterHypergraphComparisonServiceServer(syncServer, hyperSync)
|
||||
go func() {
|
||||
|
||||
@ -473,30 +473,18 @@ func (hg *Hypergraph) Commit() [][]byte {
|
||||
commits := [][]byte{}
|
||||
for _, vertexAdds := range hg.vertexAdds {
|
||||
root := vertexAdds.tree.Commit(false)
|
||||
if bytes.Equal(root, []byte{}) {
|
||||
root = vertexAdds.tree.Commit(true)
|
||||
}
|
||||
commits = append(commits, root)
|
||||
}
|
||||
for _, vertexRemoves := range hg.vertexRemoves {
|
||||
root := vertexRemoves.tree.Commit(false)
|
||||
if bytes.Equal(root, []byte{}) {
|
||||
root = vertexRemoves.tree.Commit(true)
|
||||
}
|
||||
commits = append(commits, root)
|
||||
}
|
||||
for _, hyperedgeAdds := range hg.hyperedgeAdds {
|
||||
root := hyperedgeAdds.tree.Commit(false)
|
||||
if bytes.Equal(root, []byte{}) {
|
||||
root = hyperedgeAdds.tree.Commit(true)
|
||||
}
|
||||
commits = append(commits, root)
|
||||
}
|
||||
for _, hyperedgeRemoves := range hg.hyperedgeRemoves {
|
||||
root := hyperedgeRemoves.tree.Commit(false)
|
||||
if bytes.Equal(root, []byte{}) {
|
||||
root = hyperedgeRemoves.tree.Commit(true)
|
||||
}
|
||||
commits = append(commits, root)
|
||||
}
|
||||
return commits
|
||||
|
||||
Loading…
Reference in New Issue
Block a user