MCPcopy Create free account
hub / github.com/tendermint/tendermint / TestRProcessBlockFailures

Function TestRProcessBlockFailures

internal/blocksync/v2/processor_test.go:219–264  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

217}
218
219func TestRProcessBlockFailures(t *testing.T) {
220 tests := []testFields{
221 {
222 name: "blocks H+1 and H+2 present from different peers - H+1 verification fails ",
223 steps: []pcFsmMakeStateValues{
224 {
225 currentState: &params{items: []pcBlock{{"P1", 1}, {"P2", 2}}, verBL: []int64{1}}, event: rProcessBlock{},
226 wantState: &params{items: []pcBlock{}, verBL: []int64{1}},
227 wantNextEvent: pcBlockVerificationFailure{height: 1, firstPeerID: "P1", secondPeerID: "P2"},
228 },
229 },
230 },
231 {
232 name: "blocks H+1 and H+2 present from same peer - H+1 applyBlock fails ",
233 steps: []pcFsmMakeStateValues{
234 {
235 currentState: &params{items: []pcBlock{{"P1", 1}, {"P2", 2}}, appBL: []int64{1}}, event: rProcessBlock{},
236 wantState: &params{items: []pcBlock{}, appBL: []int64{1}}, wantPanic: true,
237 },
238 },
239 },
240 {
241 name: "blocks H+1 and H+2 present from same peers - H+1 verification fails ",
242 steps: []pcFsmMakeStateValues{
243 {
244 currentState: &params{height: 0, items: []pcBlock{{"P1", 1}, {"P1", 2}, {"P2", 3}},
245 verBL: []int64{1}}, event: rProcessBlock{},
246 wantState: &params{height: 0, items: []pcBlock{{"P2", 3}}, verBL: []int64{1}},
247 wantNextEvent: pcBlockVerificationFailure{height: 1, firstPeerID: "P1", secondPeerID: "P1"},
248 },
249 },
250 },
251 {
252 name: "blocks H+1 and H+2 present from different peers - H+1 applyBlock fails ",
253 steps: []pcFsmMakeStateValues{
254 {
255 currentState: &params{items: []pcBlock{{"P1", 1}, {"P2", 2}, {"P2", 3}}, appBL: []int64{1}},
256 event: rProcessBlock{},
257 wantState: &params{items: []pcBlock{{"P2", 3}}, appBL: []int64{1}}, wantPanic: true,
258 },
259 },
260 },
261 }
262
263 executeProcessorTests(t, tests)
264}
265
266func TestScFinishedEv(t *testing.T) {
267 tests := []testFields{

Callers

nothing calls this directly

Calls 1

executeProcessorTestsFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…