(t *testing.T)
| 217 | } |
| 218 | |
| 219 | func 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: ¶ms{items: []pcBlock{{"P1", 1}, {"P2", 2}}, verBL: []int64{1}}, event: rProcessBlock{}, |
| 226 | wantState: ¶ms{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: ¶ms{items: []pcBlock{{"P1", 1}, {"P2", 2}}, appBL: []int64{1}}, event: rProcessBlock{}, |
| 236 | wantState: ¶ms{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: ¶ms{height: 0, items: []pcBlock{{"P1", 1}, {"P1", 2}, {"P2", 3}}, |
| 245 | verBL: []int64{1}}, event: rProcessBlock{}, |
| 246 | wantState: ¶ms{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: ¶ms{items: []pcBlock{{"P1", 1}, {"P2", 2}, {"P2", 3}}, appBL: []int64{1}}, |
| 256 | event: rProcessBlock{}, |
| 257 | wantState: ¶ms{items: []pcBlock{{"P2", 3}}, appBL: []int64{1}}, wantPanic: true, |
| 258 | }, |
| 259 | }, |
| 260 | }, |
| 261 | } |
| 262 | |
| 263 | executeProcessorTests(t, tests) |
| 264 | } |
| 265 | |
| 266 | func TestScFinishedEv(t *testing.T) { |
| 267 | tests := []testFields{ |
nothing calls this directly
no test coverage detected
searching dependent graphs…