-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: handle submitBlockReward correctly when processing system transa…
…ctions When getting over the DPoS hardfork, we get "insufficient funds for gas * price + value" error when using debug API. As the submitBlockReward is a system transaction, it's handled differently from the normal transactions. When consensus processes submitBlockReward and there are rewards from transaction fee in block, consensus transfers balance from SystemAddress to miner address through the statedb.SetBalance directly. Later, when the system transaction is created, this reward will be transfer from miner to staking contract. Currently, in debug API and state accessor, we treat all transactions as normal transactions. Without special handling, we miss the state transaction to transfer balance from SystemAddress to miner. Consequently, when the system transaction is processed, we get the error because there is a transfer from miner to staking contract but we see that miner's balance is not sufficient for the transfer. This commit checks whether the transaction is submitBlockReward with non-zero msg.value then adds the state transition to transfer from SystemAddress to miner to fix the above error.
- Loading branch information
Showing
5 changed files
with
98 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters