consensus, internal, contracts: remove extra hash and string conversions (#830)

* consensus, internal: remove extra hash conversions

* contracts: remove extra string conversions
This commit is contained in:
JukLee0ira 2025-02-07 13:59:07 +08:00 committed by GitHub
parent 33b16b5efe
commit d6b136ed7c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 4 additions and 4 deletions

View file

@ -353,7 +353,7 @@ func (f *Forensics) FindAncestorBlockHash(chain consensus.ChainReader, firstBloc
}
// Now, they are on the same starting line, we try find the common ancestor
for lowerBlockNumHash.Hex() != higherBlockNumberHash.Hex() {
for lowerBlockNumHash != higherBlockNumberHash {
lowerBlockNumHash = chain.GetHeaderByHash(lowerBlockNumHash).ParentHash
higherBlockNumberHash = chain.GetHeaderByHash(higherBlockNumberHash).ParentHash
// Append the path

View file

@ -56,7 +56,7 @@ func TestYourTurnInitialV2(t *testing.T) {
assert.NotNil(t, snap)
masterNodes := adaptor.EngineV1.GetMasternodesFromCheckpointHeader(block900.Header())
for i := 0; i < len(masterNodes); i++ {
assert.Equal(t, masterNodes[i].Hex(), snap.NextEpochCandidates[i].Hex())
assert.Equal(t, masterNodes[i], snap.NextEpochCandidates[i])
}
}

View file

@ -106,7 +106,7 @@ func TestSendTxSign(t *testing.T) {
t.Fatalf("Can't get signers: %v", err)
}
if signers[0].String() != oldBlocks[blockHash].String() {
if signers[0] != oldBlocks[blockHash] {
t.Errorf("Tx sign for block signer not match %v - %v", signers[0].String(), oldBlocks[blockHash].String())
}

View file

@ -248,7 +248,7 @@ func (s *PublicTxPoolAPI) Inspect() map[string]map[string]map[string]string {
// Define a formatter to flatten a transaction into a string
var format = func(tx *types.Transaction) string {
if to := tx.To(); to != nil {
return fmt.Sprintf("%s: %v wei + %v gas × %v wei", tx.To().Hex(), tx.Value(), tx.Gas(), tx.GasPrice())
return fmt.Sprintf("%s: %v wei + %v gas × %v wei", to, tx.Value(), tx.Gas(), tx.GasPrice())
}
return fmt.Sprintf("contract creation: %v wei + %v gas × %v wei", tx.Value(), tx.Gas(), tx.GasPrice())
}