Add service.NewSyncTransition
@@ -23,6 +23,7 @@ import (
"github.com/icon-project/goloop/service/contract"
"github.com/icon-project/goloop/service/eeproxy"
"github.com/icon-project/goloop/service/state"
+ "github.com/icon-project/goloop/service/sync"
)
// NewInitTransition creates initial transition based on the last result.
@@ -108,3 +109,19 @@ func FinalizeTransition(tr module.Transition, opt int, noFlush bool) error {
}
return nil
}
+
+type SyncManager interface {
+ NewSyncer(ah, prh, nrh, vh, ed []byte) sync.Syncer
+}
+
+func NewSyncTransition(
+ tr module.Transition,
+ sm SyncManager,
+ result []byte, vl[]byte,
+) module.Transition {
+ tst := tr.(*transition)
+ ntr := newTransition(tst.parent, tst.patchTransactions, tst.normalTransactions, tst.bi, tst.csi, true)
+ r, _ := newTransitionResultFromBytes(result)
+ ntr.syncer = sm.NewSyncer(r.StateHash, r.PatchReceiptHash, r.NormalReceiptHash, vl, r.ExtensionData)
+ return ntr
+}
\ No newline at end of file
