简体   繁体   中英

two unknow parameters in Go-Ethereum function

Im new in Go-EVM, and some time ago I got a source code to get transaction tracking. But some functions in the source codes have been updated and changed, here are some questions I wanna ask:

The first one is: How to get *snapshot.Tree?

stateDB, err := state.New(block.Root(), state.NewDatabase(db))   

Now this statements need three parameter and the lost parameter's type is *sanpshot.Tree. It is a struct, here is the link to its source code , in line 164.

The second one is: What are AsseccList and GasTipFee?

message := types.NewMessage(from, tx.To(), 0, tx.Value(), tx.Gas(), from Address, to Address, nonce, amount, gasLimit, tx.GasPrice(), GasTopfee, GasTipFee, tx.Data(), accesslist AccessList, false)   

AccessList is also a struct. You can see its struct from here . What should I input into AccessList and GasTipFee?
Really appreciate it if you can help me solve these questions.

In your case you do not need to pass a tree snapshot if you do not have one. The purpose of the tree snapshot is to, if the snapshot matches with the given root of the block's trie, run what they call a pre-fetcher routine, that is in charge of preloading nodes in memory so that when the state reaches the commit phase, it is more performant because it already has most of the required nodes in memory. So in your case, you should be perfectly fine passing nil to that constructor.

As for the AccessList and GasTipFee parameters:

  • AccessList is an EIP-2930 access list. It's once again something optional that transactions can provide to specify the addresses and storage keys that they need access to. Once again you can provide a nil slice.
  • What you have called GasTipFee is called GasTipCap on master and is basically the limit value of a gas tip, as far as I understand. You can find more information on gas fees in the official documentation.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM