Skip to content

Commit 7ced28a

Browse files
Resolve discrepany (cosmos#644)
1 parent dcb2092 commit 7ced28a

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

block/manager.go

+7
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,13 @@ func (m *Manager) publishBlock(ctx context.Context) error {
461461

462462
// Apply the block but DONT commit
463463
newState, responses, err := m.executor.ApplyBlock(ctx, m.lastState, block)
464+
465+
if err != nil {
466+
return err
467+
}
468+
469+
// SaveBlock commits the DB tx
470+
err = m.store.SaveBlock(block, commit)
464471
if err != nil {
465472
return err
466473
}

node/integration_test.go

+3-6
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package node
33
import (
44
"context"
55
"crypto/rand"
6+
"fmt"
67
mrand "math/rand"
78
"strconv"
89
"strings"
@@ -127,9 +128,7 @@ func TestTxGossipingAndAggregation(t *testing.T) {
127128
require.NoError(err)
128129
nodeBlock, err := nodes[i].Store.LoadBlock(h)
129130
require.NoError(err)
130-
// Only Intermediate state roots set by block aggregator are relevant, removed for sake of comparison
131-
nodeBlock.Data.IntermediateStateRoots.RawRootsList = nil
132-
assert.Equal(aggBlock, nodeBlock)
131+
assert.Equal(aggBlock, nodeBlock, fmt.Sprintf("height: %d", h))
133132
}
134133
}
135134
}
@@ -186,8 +185,6 @@ func TestFraudProofTrigger(t *testing.T) {
186185
require.NoError(err)
187186
aggBlock, err := nodes[0].Store.LoadBlock(h)
188187
require.NoError(err)
189-
// Only Intermediate state roots set by block aggregator are relevant, removed for sake of comparison
190-
nodeBlock.Data.IntermediateStateRoots.RawRootsList = nil
191188
assert.Equal(aggBlock, nodeBlock)
192189
}
193190
}
@@ -198,7 +195,7 @@ func createAndStartNodes(clientNodes int, isMalicious bool, t *testing.T) ([]*No
198195
var wg sync.WaitGroup
199196
aggCtx, aggCancel := context.WithCancel(context.Background())
200197
ctx, cancel := context.WithCancel(context.Background())
201-
nodes, apps := createNodes(aggCtx, ctx, clientNodes+1, true, &wg, t)
198+
nodes, apps := createNodes(aggCtx, ctx, clientNodes+1, isMalicious, &wg, t)
202199
startNodes(nodes, &wg, t)
203200
aggCancel()
204201
time.Sleep(100 * time.Millisecond)

0 commit comments

Comments
 (0)