go-ethereum
go-ethereum copied to clipboard
core: ensure increasing BlockGen withdrawal index
Previously, during chain generation, AddWithdrawal would look at parent blocks to determine what the proper withdrawal index is when adding a withdrawal. This was flawed because if there were no withdrawals in parent blocks, and one block added multiple withdrawals, those withdrawals would be given the same index.
The AddWithdrawal method is changed, setting the index based on the withdrawal with the highest index in the current block, if there are any other withdrawals.
A test is added, derived from the withdrawals branch of rpctestgen, making sure same-block withdrawals have increasing indexes.
hmmm, when running the test TestHeaderInsertion individually, it passes, but when running core tests with the new test, it fails. removing the test I added also causes TestHeaderInsertion to pass, wondering what could cause this
🚀 thank you for the reviews and followup work!