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 {
306
306
if parent == nil {
307
307
return errors .New ("parent not found" )
308
308
}
309
- return c .eth .BlockChain ().SetHead (parent .NumberU64 ())
309
+ _ , err := c .eth .BlockChain ().SetCanonical (parent )
310
+ return err
310
311
}
311
312
312
313
// 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) {
194
194
// 2. Send a transaction.
195
195
// 3. Check that the TX is included in block 1.
196
196
// 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 .
199
199
func TestForkResendTx (t * testing.T ) {
200
200
t .Parallel ()
201
201
testAddr := crypto .PubkeyToAddress (testKey .PublicKey )
@@ -231,12 +231,8 @@ func TestForkResendTx(t *testing.T) {
231
231
232
232
// 5.
233
233
sim .Commit ()
234
- if err := client .SendTransaction (ctx , tx ); err != nil {
235
- t .Fatalf ("sending transaction: %v" , err )
236
- }
237
- sim .Commit ()
238
234
receipt , _ = client .TransactionReceipt (ctx , tx .Hash ())
239
- if h := receipt .BlockNumber .Uint64 (); h != 2 {
235
+ if h := receipt .BlockNumber .Uint64 (); h != 1 {
240
236
t .Errorf ("TX included in wrong block: %d" , h )
241
237
}
242
238
}
You can’t perform that action at this time.
0 commit comments