internal refactoring. No logic changes
@@ -36,6 +36,14 @@ type transitionState struct {
patchReceipts *receiptList
}
+func newInitialTransitionState(state trie.Mutable) *transitionState {
+ return &transitionState{state: state}
+}
+
+func newFinalTransitionState(validatorList module.ValidatorList) *transitionState {
+ return &transitionState{nextValidatorList: validatorList}
+}
+
type transition struct {
parent *transition
@@ -69,9 +77,7 @@ func newTransition(parent *transition, patchTxList *transactionlist, normalTxLis
parent: parent,
patchTransactions: patchTxList,
normalTransactions: normalTxList,
- transitionState: &transitionState{
- state: state,
- },
+ transitionState: newInitialTransitionState(state),
step: step,
}
}
@@ -81,9 +87,7 @@ func newInitTransition(db db.Database, result []byte, validatorList module.Valid
return &transition{
db: db,
result: result,
- transitionState: &transitionState{
- nextValidatorList: validatorList,
- },
+ transitionState: newFinalTransitionState(validatorList),
step: stepComplete,
}
}
@@ -149,7 +153,7 @@ func (t *transition) executeSync(alreadyValidated bool) {
if !alreadyValidated {
txdb, err := t.db.GetBucket(db.TransactionLocatorByHash)
if err != nil {
- panic("can't get bucket TransactionLocatorByHash")
+ panic("FAIL to get bucket TransactionLocatorByHash")
}
if !t.validateTxs(t.patchTransactions, txdb) || !t.validateTxs(t.normalTransactions, txdb) {
return
