@@ -13,17 +13,27 @@ import (
1313
1414func TestHandleBroadcastRawLog (t * testing.T ) {
1515 txHash := common .HexToHash ("0x123" )
16- cases := []string {
17- legacypool .ErrOutOfOrderTxFromDelegated .Error (),
18- txpool .ErrInflightTxLimitReached .Error (),
19- legacypool .ErrAuthorityReserved .Error (),
20- txpool .ErrUnderpriced .Error (),
21- legacypool .ErrTxPoolOverflow .Error (),
22- legacypool .ErrFutureReplacePending .Error (),
23- mempool .ErrNonceGap .Error (),
16+ tmpErrMsg := "transaction temporarily rejected or queued"
17+ cases := []struct {
18+ rawLog string
19+ wantMsg string
20+ }{
21+ {legacypool .ErrOutOfOrderTxFromDelegated .Error (), tmpErrMsg },
22+ {txpool .ErrInflightTxLimitReached .Error (), tmpErrMsg },
23+ {legacypool .ErrAuthorityReserved .Error (), tmpErrMsg },
24+ {txpool .ErrUnderpriced .Error (), tmpErrMsg },
25+ {legacypool .ErrTxPoolOverflow .Error (), tmpErrMsg },
26+ {legacypool .ErrFutureReplacePending .Error (), tmpErrMsg },
27+ {mempool .ErrNonceGap .Error (), "transaction queued due to nonce gap" },
2428 }
25- for _ , rawLog := range cases {
26- require .True (t , HandleBroadcastRawLog (rawLog , txHash ), "expected true for: %s" , rawLog )
29+
30+ for _ , tc := range cases {
31+ ok , msg := HandleBroadcastRawLog (tc .rawLog , txHash )
32+ require .True (t , ok , "expected true for: %s" , tc .rawLog )
33+ require .Equal (t , tc .wantMsg , msg , "unexpected message for: %s" , tc .rawLog )
2734 }
28- require .False (t , HandleBroadcastRawLog ("some other error" , txHash ))
35+
36+ ok , msg := HandleBroadcastRawLog ("some other error" , txHash )
37+ require .False (t , ok )
38+ require .Equal (t , "" , msg )
2939}
0 commit comments