From b6912c10476bf24c25b780b91a892a71fba268b6 Mon Sep 17 00:00:00 2001 From: rene <41963722+renaynay@users.noreply.github.com> Date: Mon, 29 Mar 2021 19:54:49 +0100 Subject: [PATCH] core: add BlockGen.GetBalance method (#22589) --- core/chain_makers.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/chain_makers.go b/core/chain_makers.go index 33f253d9e..e058e5a78 100644 --- a/core/chain_makers.go +++ b/core/chain_makers.go @@ -111,6 +111,11 @@ func (b *BlockGen) AddTxWithChain(bc *BlockChain, tx *types.Transaction) { b.receipts = append(b.receipts, receipt) } +// GetBalance returns the balance of the given address at the generated block. +func (b *BlockGen) GetBalance(addr common.Address) *big.Int { + return b.statedb.GetBalance(addr) +} + // AddUncheckedTx forcefully adds a transaction to the block without any // validation. //