Update to plugeth-statediff 0.1.4 #2

Merged
roysc merged 6 commits from telackey/014 into v5 2023-09-30 05:50:07 +00:00
Showing only changes of commit c7ccdf3b3d - Show all commits

View File

@ -220,17 +220,16 @@ func (v *Validator) iterate(it trie.NodeIterator, storage bool) error {
// Traverses each iterator in a separate goroutine.
// Dumps to a recovery file on failure or interrupt.
func iterateTracked(tree state.Trie, recoveryFile string, iterCount uint, fn func(trie.NodeIterator) error) error {
ctx, cancelCtx := context.WithCancel(context.Background())
ctx, _ := context.WithCancel(context.Background())
tracker := tracker.New(recoveryFile, iterCount)
tracker.CaptureSignal(cancelCtx)

What's the replacement scheme for CaptureSignal()?

What's the replacement scheme for CaptureSignal()?
Review

it was such a simple function, I just removed it from the package.

	signal.Notify(sigChan, syscall.SIGINT, syscall.SIGTERM)
	go func() {
		sig := <-sigChan
		log.Errorf("Signal received (%v), stopping", sig)
		cancel()
	}()
it was such a simple function, I just removed it from the package. ```go signal.Notify(sigChan, syscall.SIGINT, syscall.SIGTERM) go func() { sig := <-sigChan log.Errorf("Signal received (%v), stopping", sig) cancel() }() ```
Review

But the context doesn't really do anything here (and never did), we need to add a bit more plumbing.

But the context doesn't really do anything here (and never did), we need to add a bit more plumbing.
Review

So is the "fix" of just dropping the line appropriate at the moment?

So is the "fix" of just dropping the line appropriate at the moment?
Review

Yes, it can wait

Yes, it can wait
Review

I made a follow up PR. Also need to fix it for snapshots cerc-io/ipld-eth-state-snapshot#2

I made a follow up PR. Also need to fix it for snapshots https://git.vdb.to/cerc-io/ipld-eth-state-snapshot/issues/2
halt := func() {
if err := tracker.HaltAndDump(); err != nil {
if err := tracker.CloseAndSave(); err != nil {
log.Errorf("failed to write recovery file: %v", err)
}
}
// attempt to restore from recovery file if it exists
iters, err := tracker.Restore(tree.NodeIterator)
iters, _, err := tracker.Restore(tree.NodeIterator)
if err != nil {
return err
}