From e124173a81785916600250561b2ea94983e08992 Mon Sep 17 00:00:00 2001 From: Konstantin <355847+Frozen@users.noreply.github.com> Date: Sun, 29 Oct 2023 17:48:30 -0800 Subject: [PATCH] Cleanup. (#4547) * Cleanup * Cleanup --- Makefile | 3 --- core/blockchain_impl.go | 2 -- core/state_processor.go | 10 +++++++++- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 6fc8f2607..906e8c06a 100644 --- a/Makefile +++ b/Makefile @@ -180,6 +180,3 @@ debug_external: clean build_localnet_validator: bash test/build-localnet-validator.sh - -tt: - go test -v -test.run OnDisconnectCheck ./p2p/security \ No newline at end of file diff --git a/core/blockchain_impl.go b/core/blockchain_impl.go index b12de5637..e9eca1f4c 100644 --- a/core/blockchain_impl.go +++ b/core/blockchain_impl.go @@ -1682,8 +1682,6 @@ func (bc *BlockChainImpl) insertChain(chain types.Blocks, verifyHeaders bool) (i if len(chain) == 0 { return 0, nil, nil, ErrEmptyChain } - first := chain[0] - fmt.Println("insertChain", utils.GetPort(), first.ShardID(), first.Epoch().Uint64(), first.NumberU64()) // Do a sanity check that the provided chain is actually ordered and linked for i := 1; i < len(chain); i++ { if chain[i].NumberU64() != chain[i-1].NumberU64()+1 || chain[i].ParentHash() != chain[i-1].Hash() { diff --git a/core/state_processor.go b/core/state_processor.go index 6ea9e244a..9ccb256a7 100644 --- a/core/state_processor.go +++ b/core/state_processor.go @@ -310,7 +310,15 @@ func ApplyTransaction(bc ChainContext, author *common.Address, gp *GasPool, stat // Apply the transaction to the current state (included in the env) result, err := ApplyMessage(vmenv, msg, gp) if err != nil { - return nil, nil, nil, 0, errors.Wrapf(err, "apply failed from='%s' to='%s' balance='%s'", msg.From().Hex(), msg.To().Hex(), statedb.GetBalance(msg.From()).String()) + to := "" + if m := msg.To(); m != nil { + to = m.Hex() + } + balance := "" + if a := statedb.GetBalance(msg.From()); a != nil { + balance = a.String() + } + return nil, nil, nil, 0, errors.Wrapf(err, "apply failed from='%s' to='%s' balance='%s'", msg.From().Hex(), to, balance) } // Update the state with pending changes var root []byte