Skip to content
This repository was archived by the owner on Oct 20, 2024. It is now read-only.

Commit 2710cf0

Browse files
committed
blocksim: skip tx from and to coinbase
Squashed commit of the following: commit 0de303f Author: Chris Hager <[email protected]> Date: Mon Aug 16 21:54:34 2021 +0200 blocksim: skip tx to coinbase commit 0b9486a Author: Chris Hager <[email protected]> Date: Mon Aug 16 21:52:27 2021 +0200 check simblock tx from cb
1 parent 8f8d5da commit 2710cf0

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
Fork of [ethrpc](https://github.com/onrik/ethrpc) with Flashbots RPC calls.
22

33
https://docs.flashbots.net/flashbots-auction/searchers/advanced/rpc-endpoint
4+
5+
TODO:
6+
7+
* Simulate block: account for outgoing transactions from coinbase (pool paying miners)

flashbotsrpc.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -611,6 +611,23 @@ func (rpc *FlashbotsRPC) FlashbotsSimulateBlock(privKey *ecdsa.PrivateKey, block
611611
txs := make([]string, 0)
612612
for _, tx := range block.Transactions() {
613613
// fmt.Println("tx", i, tx.Hash(), "type", tx.Type())
614+
from, fromErr := types.Sender(types.LatestSignerForChainID(tx.ChainId()), tx)
615+
txIsFromCoinbase := fromErr == nil && from == block.Coinbase()
616+
if txIsFromCoinbase {
617+
if rpc.Debug {
618+
fmt.Printf("- skip tx from coinbase: %s\n", tx.Hash())
619+
}
620+
continue
621+
}
622+
623+
to := tx.To()
624+
txIsToCoinbase := to != nil && *to == block.Coinbase()
625+
if txIsToCoinbase {
626+
if rpc.Debug {
627+
fmt.Printf("- skip tx to coinbase: %s\n", tx.Hash())
628+
}
629+
continue
630+
}
614631

615632
rlp := TxToRlp(tx)
616633

0 commit comments

Comments
 (0)