mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 15:16:43 +00:00
fix: TestRPCGetTransactionReceiptsByBlock
This commit is contained in:
parent
02faed0a32
commit
fc30355849
4 changed files with 22 additions and 21 deletions
|
|
@ -521,7 +521,7 @@ func (ethash *Ethash) FinalizeAndAssemble(chain consensus.ChainHeaderReader, hea
|
||||||
header.Root = state.IntermediateRoot(chain.Config().IsEIP158(header.Number))
|
header.Root = state.IntermediateRoot(chain.Config().IsEIP158(header.Number))
|
||||||
|
|
||||||
// Header seems complete, assemble into a block and return
|
// Header seems complete, assemble into a block and return
|
||||||
return types.NewBlock(header, &types.Body{Transactions: body.Transactions, Uncles: body.Uncles}, receipts, trie.NewStackTrie(nil)), nil
|
return types.NewBlock(header, &types.Body{Transactions: body.Transactions, Uncles: body.Uncles, Withdrawals: body.Withdrawals}, receipts, trie.NewStackTrie(nil)), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// SealHash returns the hash of a block prior to it being sealed.
|
// SealHash returns the hash of a block prior to it being sealed.
|
||||||
|
|
|
||||||
11
core/evm.go
11
core/evm.go
|
|
@ -150,6 +150,17 @@ func CanTransfer(db vm.StateDB, addr common.Address, amount *uint256.Int) bool {
|
||||||
|
|
||||||
// Transfer subtracts amount from sender and adds amount to recipient using the given Db
|
// Transfer subtracts amount from sender and adds amount to recipient using the given Db
|
||||||
func Transfer(db vm.StateDB, sender, recipient common.Address, amount *uint256.Int) {
|
func Transfer(db vm.StateDB, sender, recipient common.Address, amount *uint256.Int) {
|
||||||
|
// get inputs before
|
||||||
|
input1 := db.GetBalance(sender)
|
||||||
|
input2 := db.GetBalance(recipient)
|
||||||
|
|
||||||
db.SubBalance(sender, amount, tracing.BalanceChangeTransfer)
|
db.SubBalance(sender, amount, tracing.BalanceChangeTransfer)
|
||||||
db.AddBalance(recipient, amount, tracing.BalanceChangeTransfer)
|
db.AddBalance(recipient, amount, tracing.BalanceChangeTransfer)
|
||||||
|
|
||||||
|
// get outputs after
|
||||||
|
output1 := db.GetBalance(sender)
|
||||||
|
output2 := db.GetBalance(recipient)
|
||||||
|
|
||||||
|
// add transfer log
|
||||||
|
AddTransferLog(db, sender, recipient, amount.ToBig(), input1.ToBig(), input2.ToBig(), output1.ToBig(), output2.ToBig())
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -443,7 +443,7 @@ func newTestBackend(t *testing.T, n int, gspec *core.Genesis, engine consensus.E
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
accman, acc := newTestAccountManager(t)
|
accman, acc := newTestAccountManager(t)
|
||||||
gspec.Alloc[acc.Address] = types.Account{Balance: big.NewInt(params.Ether)}
|
// gspec.Alloc[acc.Address] = types.Account{Balance: big.NewInt(params.Ether)}
|
||||||
// Generate blocks for testing
|
// Generate blocks for testing
|
||||||
db, blocks, _ := core.GenerateChainWithGenesis(gspec, engine, n, generator)
|
db, blocks, _ := core.GenerateChainWithGenesis(gspec, engine, n, generator)
|
||||||
txlookupLimit := uint64(0)
|
txlookupLimit := uint64(0)
|
||||||
|
|
|
||||||
|
|
@ -1764,8 +1764,6 @@ func (w *worker) commit(ctx context.Context, env *environment, interval func(),
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we're post merge, just ignore
|
|
||||||
if !w.isTTDReached(block.Header()) {
|
|
||||||
select {
|
select {
|
||||||
case w.taskCh <- &task{ctx: ctx, receipts: env.receipts, state: env.state, block: block, createdAt: time.Now()}:
|
case w.taskCh <- &task{ctx: ctx, receipts: env.receipts, state: env.state, block: block, createdAt: time.Now()}:
|
||||||
fees := totalFees(block, env.receipts)
|
fees := totalFees(block, env.receipts)
|
||||||
|
|
@ -1778,7 +1776,6 @@ func (w *worker) commit(ctx context.Context, env *environment, interval func(),
|
||||||
log.Info("Worker has exited")
|
log.Info("Worker has exited")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if update {
|
if update {
|
||||||
w.updateSnapshot(env)
|
w.updateSnapshot(env)
|
||||||
|
|
@ -1806,13 +1803,6 @@ func (w *worker) getSealingBlock(params *generateParams) *newPayloadResult {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// isTTDReached returns the indicator if the given block has reached the total
|
|
||||||
// terminal difficulty for The Merge transition.
|
|
||||||
func (w *worker) isTTDReached(header *types.Header) bool {
|
|
||||||
td, ttd := w.chain.GetTd(header.ParentHash, header.Number.Uint64()-1), w.chain.Config().TerminalTotalDifficulty
|
|
||||||
return td != nil && ttd != nil && td.Cmp(ttd) >= 0
|
|
||||||
}
|
|
||||||
|
|
||||||
// adjustResubmitInterval adjusts the resubmit interval.
|
// adjustResubmitInterval adjusts the resubmit interval.
|
||||||
func (w *worker) adjustResubmitInterval(message *intervalAdjust) {
|
func (w *worker) adjustResubmitInterval(message *intervalAdjust) {
|
||||||
select {
|
select {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue