Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rm debugging assistance code for api #881

Merged
merged 1 commit into from
Jul 31, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 0 additions & 31 deletions cmd/rpcdaemon/commands/send_transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,7 @@ import (
"github.com/gateway-fm/cdk-erigon-lib/common"
"github.com/gateway-fm/cdk-erigon-lib/common/hexutility"
txPoolProto "github.com/gateway-fm/cdk-erigon-lib/gointerfaces/txpool"
"github.com/ledgerwatch/log/v3"

"github.com/ledgerwatch/erigon/core/rawdb"
"github.com/ledgerwatch/erigon/core/types"
"github.com/ledgerwatch/erigon/crypto"
"github.com/ledgerwatch/erigon/eth/ethconfig"
"github.com/ledgerwatch/erigon/params"
"github.com/ledgerwatch/erigon/rlp"
Expand Down Expand Up @@ -70,33 +66,6 @@ func (api *APIImpl) SendRawTransaction(ctx context.Context, encodedTx hexutility
return hash, fmt.Errorf("%s: %s", txPoolProto.ImportResult_name[int32(res.Imported[0])], res.Errors[0])
}

// Print a log with full txn details for manual investigations and interventions
blockNum := rawdb.ReadCurrentBlockNumber(tx)
if blockNum == nil {
return common.Hash{}, err
}

txnChainId := txn.GetChainID()

if txn.Protected() {
if chainId.Cmp(txnChainId.ToBig()) != 0 {
return common.Hash{}, fmt.Errorf("invalid chain id, expected: %d got: %d", chainId, *txnChainId)
}
}

signer := types.MakeSigner(cc, *blockNum)
from, err := txn.Sender(*signer)
if err != nil {
return common.Hash{}, err
}

if txn.GetTo() == nil {
addr := crypto.CreateAddress(from, txn.GetNonce())
log.Debug("Submitted contract creation", "hash", txn.Hash().Hex(), "from", from, "nonce", txn.GetNonce(), "contract", addr.Hex(), "value", txn.GetValue())
} else {
log.Debug("Submitted transaction", "hash", txn.Hash().Hex(), "from", from, "nonce", txn.GetNonce(), "recipient", txn.GetTo(), "value", txn.GetValue())
}

return txn.Hash(), nil
}

Expand Down
Loading