File tree Expand file tree Collapse file tree 2 files changed +5
-8
lines changed Expand file tree Collapse file tree 2 files changed +5
-8
lines changed Original file line number Diff line number Diff line change @@ -306,7 +306,8 @@ func (c *SimulatedBeacon) Fork(parentHash common.Hash) error {
306306 if parent == nil {
307307 return errors .New ("parent not found" )
308308 }
309- return c .eth .BlockChain ().SetHead (parent .NumberU64 ())
309+ _ , err := c .eth .BlockChain ().SetCanonical (parent )
310+ return err
310311}
311312
312313// AdjustTime creates a new block with an adjusted timestamp.
Original file line number Diff line number Diff line change @@ -194,8 +194,8 @@ func TestFork(t *testing.T) {
194194// 2. Send a transaction.
195195// 3. Check that the TX is included in block 1.
196196// 4. Fork by using the parent block as ancestor.
197- // 5. Mine a block, Re-send the transaction and mine another one .
198- // 6. Check that the TX is now included in block 2 .
197+ // 5. Mine a block. We expect the out-forked tx to have trickled to the pool, and into the new block .
198+ // 6. Check that the TX is now included in (the new) block 1 .
199199func TestForkResendTx (t * testing.T ) {
200200 t .Parallel ()
201201 testAddr := crypto .PubkeyToAddress (testKey .PublicKey )
@@ -231,12 +231,8 @@ func TestForkResendTx(t *testing.T) {
231231
232232 // 5.
233233 sim .Commit ()
234- if err := client .SendTransaction (ctx , tx ); err != nil {
235- t .Fatalf ("sending transaction: %v" , err )
236- }
237- sim .Commit ()
238234 receipt , _ = client .TransactionReceipt (ctx , tx .Hash ())
239- if h := receipt .BlockNumber .Uint64 (); h != 2 {
235+ if h := receipt .BlockNumber .Uint64 (); h != 1 {
240236 t .Errorf ("TX included in wrong block: %d" , h )
241237 }
242238}
You can’t perform that action at this time.
0 commit comments