forked from TrueCloudLab/neoneo-go
notary: fix "Condition never satisfied" in Notary test, fix #2422
The theory is: * we add a block * it triggers notary * which can process the fallback before we're to setFinalizeWithError * it'll fail and require an additional block to enter, but it's never added * FAIL The solution is: * always add an additional block, but treat the first fb specially Signed-off-by: Roman Khimov <roman@nspcc.ru>
This commit is contained in:
parent
49edf9e498
commit
d2a7162217
1 changed files with 6 additions and 14 deletions
|
@ -600,22 +600,14 @@ func TestNotary(t *testing.T) {
|
||||||
// Add block before allowing tx to finalize to exclude race condition when
|
// Add block before allowing tx to finalize to exclude race condition when
|
||||||
// main transaction is finalized between `finalizeWithError` restore and adding new block.
|
// main transaction is finalized between `finalizeWithError` restore and adding new block.
|
||||||
e.AddNewBlock(t)
|
e.AddNewBlock(t)
|
||||||
mtx.RLock()
|
|
||||||
start := len(completedTxes)
|
|
||||||
mtx.RUnlock()
|
|
||||||
setFinalizeWithError(false)
|
setFinalizeWithError(false)
|
||||||
for i := range requests {
|
for i := range requests[1:] {
|
||||||
if i != 0 {
|
|
||||||
e.AddNewBlock(t)
|
e.AddNewBlock(t)
|
||||||
}
|
|
||||||
require.Eventually(t, func() bool {
|
_ = getCompletedTx(t, true, requests[i+1].FallbackTransaction.Hash())
|
||||||
mtx.RLock()
|
|
||||||
defer mtx.RUnlock()
|
|
||||||
return len(completedTxes)-start >= i+1
|
|
||||||
}, time.Second*3, time.Millisecond)
|
|
||||||
checkMainTx(t, requesters, requests, len(requests), false)
|
checkMainTx(t, requesters, requests, len(requests), false)
|
||||||
checkFallbackTxs(t, requests[:i+1], true)
|
checkFallbackTxs(t, requests[:i+2], true)
|
||||||
checkFallbackTxs(t, requests[i+1:], false)
|
checkFallbackTxs(t, requests[i+2:], false)
|
||||||
}
|
}
|
||||||
|
|
||||||
// OnRequestRemoval: missing account
|
// OnRequestRemoval: missing account
|
||||||
|
|
Loading…
Reference in a new issue