Merge PR #2644: Simulation: Print last block when there is an error

There was an off by one error in the log printing function previously
This commit is contained in:
Dev Ojha 2018-10-31 04:04:46 -07:00 committed by Christopher Goes
parent db1f45a3a9
commit 6316e1241e
2 changed files with 2 additions and 2 deletions

View File

@ -221,11 +221,11 @@ func createBlockSimulator(testingMode bool, tb testing.TB, t *testing.T, event f
accounts []Account, header abci.Header, logWriter func(string)) (opCount int) {
for j := 0; j < blocksize; j++ {
logUpdate, futureOps, err := selectOp(r)(r, app, ctx, accounts, event)
logWriter(logUpdate)
if err != nil {
displayLogs()
tb.Fatalf("error on operation %d within block %d, %v", header.Height, opCount, err)
}
logWriter(logUpdate)
queueOperations(operationQueue, timeOperationQueue, futureOps)
if testingMode {

View File

@ -134,7 +134,7 @@ func logPrinter(testingmode bool, logs []*strings.Builder) func() {
for i := 0; i < len(logs); i++ {
// We're passed the last created block
if logs[i] == nil {
numLoggers = i - 1
numLoggers = i
break
}
}