mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 07:06:42 +00:00
eth/catalyst: Fix success condition for TestSimulatedBeaconSendWithdrawals
This commit is contained in:
parent
7d99f7df00
commit
37b87242bf
1 changed files with 5 additions and 3 deletions
|
|
@ -119,6 +119,7 @@ func TestSimulatedBeaconSendWithdrawals(t *testing.T) {
|
||||||
|
|
||||||
includedTxs := make(map[common.Hash]struct{})
|
includedTxs := make(map[common.Hash]struct{})
|
||||||
var includedWithdrawals []uint64
|
var includedWithdrawals []uint64
|
||||||
|
lastHeaderNumber := big.NewInt(0)
|
||||||
|
|
||||||
timer := time.NewTimer(12 * time.Second)
|
timer := time.NewTimer(12 * time.Second)
|
||||||
for {
|
for {
|
||||||
|
|
@ -131,12 +132,13 @@ func TestSimulatedBeaconSendWithdrawals(t *testing.T) {
|
||||||
for _, includedWithdrawal := range block.Withdrawals() {
|
for _, includedWithdrawal := range block.Withdrawals() {
|
||||||
includedWithdrawals = append(includedWithdrawals, includedWithdrawal.Index)
|
includedWithdrawals = append(includedWithdrawals, includedWithdrawal.Index)
|
||||||
}
|
}
|
||||||
// ensure all withdrawals/txs included. this will take two blocks b/c number of withdrawals > 10
|
lastHeaderNumber = ev.Header.Number
|
||||||
if len(includedTxs) == len(txs) && len(includedWithdrawals) == len(withdrawals) && ev.Header.Number.Cmp(big.NewInt(2)) == 0 {
|
// ensure all withdrawals/txs included. this will take at least two blocks b/c number of withdrawals > 10
|
||||||
|
if len(includedTxs) == len(txs) && len(includedWithdrawals) == len(withdrawals) && ev.Header.Number.Cmp(big.NewInt(1)) == 1 {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
case <-timer.C:
|
case <-timer.C:
|
||||||
t.Fatal("timed out without including all withdrawals/txs")
|
t.Fatalf("timed out without including all withdrawals/txs, includedTxs len = %d, includedWithdrawls = %d, lastHeaderNumber = %d", len(includedTxs), len(includedWithdrawals), lastHeaderNumber)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue