@@ -108,41 +108,30 @@ export async function launch(kernelStateDBDir, mailboxStorage, vatsDir, argv) {
108
108
saveState ( ) ;
109
109
110
110
// then arrange for inbound messages to be processed, after which we save
111
- async function turnCrank ( committed ) {
111
+ async function turnCrank ( ) {
112
112
const start = Date . now ( ) ;
113
113
await controller . run ( ) ;
114
114
const runTime = Date . now ( ) - start ;
115
- if ( committed ) {
116
- saveState ( runTime ) ;
117
- } else {
118
- console . log ( `proposed SwingSet transaction [run=${ runTime } ms]` ) ;
119
- }
115
+ // Have to save state every time.
116
+ saveState ( runTime ) ;
120
117
}
121
118
122
- async function deliverInbound ( sender , messages , ack , committed ) {
119
+ async function deliverInbound ( sender , messages , ack , _committed ) {
123
120
if ( ! ( messages instanceof Array ) ) {
124
121
throw new Error ( `inbound given non-Array: ${ messages } ` ) ;
125
122
}
126
123
if ( mb . deliverInbound ( sender , messages , ack ) ) {
127
124
console . log ( `mboxDeliver: ADDED messages` ) ;
128
- await turnCrank ( committed ) ;
129
- } else if ( committed ) {
130
- // We need to save our state on every commitment.
131
- saveState ( ) ;
132
125
}
126
+ await turnCrank ( ) ;
133
127
}
134
128
135
- async function deliverStartBlock ( blockHeight , blockTime , committed ) {
129
+ async function deliverStartBlock ( blockHeight , blockTime , _committed ) {
136
130
const addedToQueue = timer . poll ( blockTime ) ;
137
131
console . log (
138
132
`polled; blockTime:${ blockTime } , h:${ blockHeight } ADDED: ${ addedToQueue } ` ,
139
133
) ;
140
- if ( addedToQueue ) {
141
- await turnCrank ( committed ) ;
142
- } else if ( committed ) {
143
- // We need to save our state on every commitment.
144
- saveState ( ) ;
145
- }
134
+ await turnCrank ( ) ;
146
135
}
147
136
148
137
return { deliverInbound, deliverStartBlock } ;
0 commit comments