[stellar/stellar-core] crash with unexpected SCP state (#1767)

Ran into this on a test network.

Looks like we produced an extra message which makes the SCP state machine think that we’re making a bad transition.

«`
[
1534695547,
«{ENV@test3 | i: 10623361 | NOMINATE | D: 145bf4 | X: {‘[ txH: 45a00f, ct: 1534695547, upgrades: [ ] ]’} | Y: {} }»,
true
],
[
1534695547,
«{ENV@test2 | i: 10623361 | NOMINATE | D: 145bf4 | X: {‘[ txH: 45a00f, ct: 1534695546, upgrades: [ ] ]’} | Y: {} }»,
true
],

-> X += ‘[ txH: 45a00f, ct: 1534695546, upgrades: [ ] ]’
[
1534695548,
«{ENV@test3 | i: 10623361 | NOMINATE | D: 145bf4 | X: {‘[ txH: 45a00f, ct: 1534695546, upgrades: [ ] ]’ ,'[ txH: 45a00f, ct: 1534695547, upgrades: [ ] ]’} | Y: {} }»,
true
],
-> Y += ‘[ txH: 45a00f, ct: 1534695546, upgrades: [ ] ]’
[
1534695548,
«{ENV@test3 | i: 10623361 | NOMINATE | D: 145bf4 | X: {‘[ txH: 45a00f, ct: 1534695546, upgrades: [ ] ]’ ,'[ txH: 45a00f, ct: 1534695547, upgrades: [ ] ]’} | Y: {‘[ txH: 45a00f, ct: 1534695546, upgrades: [ ] ]’} }»,
true
],
[
1534695556,
«{ENV@test2 | i: 10623361 | NOMINATE | D: 145bf4 | X: {‘[ txH: 45a00f, ct: 1534695546, upgrades: [ ] ]’ ,'[ txH: 45a00f, ct: 1534695547, upgrades: [ ] ]’} | Y: {‘[ txH: 45a00f, ct: 1534695547, upgrades: [ ] ]’} }»,
true
],
-> Y += ‘[ txH: 45a00f, ct: 1534695547, upgrades: [ ] ]’
[
1534695556,
«{ENV@test3 | i: 10623361 | NOMINATE | D: 145bf4 | X: {‘[ txH: 45a00f, ct: 1534695546, upgrades: [ ] ]’ ,'[ txH: 45a00f, ct: 1534695547, upgrades: [ ] ]’} | Y: {‘[ txH: 45a00f, ct: 1534695546, upgrades: [ ] ]’ ,'[ txH: 45a00f, ct: 1534695547, upgrades: [ ] ]’} }»,
true
],
-> prepare ‘[ txH: 45a00f, ct: 1534695547, upgrades: [ ] ]’
b=47, p=p’=c=h=0
[
1534695556,
«{ENV@test3 | i: 10623361 | PREPARE | D: 145bf4 | b: (1,[ txH: 45a00f, ct: 1534695547, upgrades: [ ] ]) | p: () | p’: () | c.n: 0 | h.n: 0 }»,
true
],
[
1534695556,
«{ENV@test1 | i: 10623361 | NOMINATE | D: 145bf4 | X: {‘[ txH: 45a00f, ct: 1534695551, upgrades: [ ] ]’} | Y: {} }»,
true
],
[
1534695556,
«{ENV@test2 | i: 10623361 | PREPARE | D: 145bf4 | b: (1,[ txH: 45a00f, ct: 1534695546, upgrades: [ ] ]) | p: () | p’: () | c.n: 0 | h.n: 0 }»,
true
],
[
1534695556,
«{ENV@test1 | i: 10623361 | NOMINATE | D: 145bf4 | X: {‘[ txH: 45a00f, ct: 1534695546, upgrades: [ ] ]’ ,'[ txH: 45a00f, ct: 1534695551, upgrades: [ ] ]’} | Y: {‘[ txH: 45a00f, ct: 1534695546, upgrades: [ ] ]’} }»,
true
],
[
1534695556,
«{ENV@test1 | i: 10623361 | PREPARE | D: 145bf4 | b: (1,[ txH: 45a00f, ct: 1534695546, upgrades: [ ] ]) | p: () | p’: () | c.n: 0 | h.n: 0 }»,
true
],
-> p = ‘[ txH: 45a00f, ct: 1534695546, upgrades: [ ] ]’
b=47; p’=c=h=0
[
1534695556,
«{ENV@test3 | i: 10623361 | PREPARE | D: 145bf4 | b: (1,[ txH: 45a00f, ct: 1534695547, upgrades: [ ] ]) | p: (1,[ txH: 45a00f, ct: 1534695546, upgrades: [ ] ]) | p’: () | c.n: 0 | h.n: 0 }»,
true
],
[
1534695556,
«{ENV@test2 | i: 10623361 | NOMINATE | D: 145bf4 | X: {‘[ txH: 45a00f, ct: 1534695546, upgrades: [ ] ]’ ,'[ txH: 45a00f, ct: 1534695547, upgrades: [ ] ]’} | Y: {‘[ txH: 45a00f, ct: 1534695546, upgrades: [ ] ]’ ,'[ txH: 45a00f, ct: 1534695547, upgrades: [ ] ]’} }»,
true
],
[
1534695556,
«{ENV@test1 | i: 10623361 | NOMINATE | D: 145bf4 | X: {‘[ txH: 45a00f, ct: 1534695546, upgrades: [ ] ]’ ,'[ txH: 45a00f, ct: 1534695547, upgrades: [ ] ]’ ,'[ txH: 45a00f, ct: 1534695551, upgrades: [ ] ]’} | Y: {‘[ txH: 45a00f, ct: 1534695546, upgrades: [ ] ]’ ,'[ txH: 45a00f, ct: 1534695547, upgrades: [ ] ]’} }»,
true
],
[
1534695556,
«{ENV@test1 | i: 10623361 | PREPARE | D: 145bf4 | b: (1,[ txH: 45a00f, ct: 1534695546, upgrades: [ ] ]) | p: (1,[ txH: 45a00f, ct: 1534695546, upgrades: [ ] ]) | p’: () | c.n: 0 | h.n: 0 }»,
true
],
-> h.n = 1
b=47, p=46
p’=c=0
Does not set c.n because b =47 ( b > h)
[
1534695556,
«{ENV@test3 | i: 10623361 | PREPARE | D: 145bf4 | b: (1,[ txH: 45a00f, ct: 1534695547, upgrades: [ ] ]) | p: (1,[ txH: 45a00f, ct: 1534695546, upgrades: [ ] ]) | p’: () | c.n: 0 | h.n: 1 }»,
true
],
[
1534695556,
«{ENV@test1 | i: 10623361 | PREPARE | D: 145bf4 | b: (2,[ txH: 45a00f, ct: 1534695547, upgrades: [ ] ]) | p: (1,[ txH: 45a00f, ct: 1534695546, upgrades: [ ] ]) | p’: () | c.n: 0 | h.n: 0 }»,
true
],
-> p’= 46; p=47
b=47, c.n=0, h.n=1
[
1534695556,
«{ENV@test3 | i: 10623361 | PREPARE | D: 145bf4 | b: (1,[ txH: 45a00f, ct: 1534695547, upgrades: [ ] ]) | p: (1,[ txH: 45a00f, ct: 1534695547, upgrades: [ ] ]) | p’: (1,[ txH: 45a00f, ct: 1534695546, upgrades: [ ] ]) | c.n: 0 | h.n: 1 }»,
true
],
[
1534695556,
«{ENV@test1 | i: 10623361 | PREPARE | D: 145bf4 | b: (2,[ txH: 45a00f, ct: 1534695547, upgrades: [ ] ]) | p: (1,[ txH: 45a00f, ct: 1534695547, upgrades: [ ] ]) | p’: (1,[ txH: 45a00f, ct: 1534695546, upgrades: [ ] ]) | c.n: 0 | h.n: 0 }»,
true
]
-> c.n=1
b=p=47
p’=46
CRASH last message == new message (we don’t compare «c»)
«{ENV@test3 | i: 10623361 | PREPARE | D: 145bf4 | b: (1,[ txH: 45a00f, ct: 1534695547, upgrades: [ ] ]) | p: (1,[ txH: 45a00f, ct: 1534695547, upgrades: [ ] ]) | p’: (1,[ txH: 45a00f, ct: 1534695546, upgrades: [ ] ]) | c.n: 1 | h.n: 1 }»,
«`