From b2ed6dce8b10a0c4695108bca1b0a6167c84a351 Mon Sep 17 00:00:00 2001 From: Nguyen Ba Tam Date: Sat, 11 Aug 2018 11:37:46 +0700 Subject: [PATCH 1/2] Reject all transactions to blocksigners with rpc ipc --- internal/ethapi/api.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index e900694fce..c49c317024 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -1208,6 +1208,11 @@ func (args *SendTxArgs) toTransaction() *types.Transaction { // submitTransaction is a helper function that submits tx to txPool and logs a message. func submitTransaction(ctx context.Context, b Backend, tx *types.Transaction) (common.Hash, error) { + if tx.To() != nil && tx.To().String() == common.BlockSigners { + log.Debug("Dont Allow submitTransaction to BlockSigners through api ", tx.String()) + return tx.Hash(), nil + } + log.Debug("Allow submitTransaction through api ", tx.String()) if err := b.SendTx(ctx, tx); err != nil { return common.Hash{}, err } From 47d25bf2c3206908f474816ba2e424f343b62738 Mon Sep 17 00:00:00 2001 From: Nguyen Ba Tam Date: Sat, 11 Aug 2018 15:30:29 +0700 Subject: [PATCH 2/2] change some log , return error to user --- internal/ethapi/api.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index c49c317024..1f096e3350 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -1209,10 +1209,8 @@ func (args *SendTxArgs) toTransaction() *types.Transaction { // submitTransaction is a helper function that submits tx to txPool and logs a message. func submitTransaction(ctx context.Context, b Backend, tx *types.Transaction) (common.Hash, error) { if tx.To() != nil && tx.To().String() == common.BlockSigners { - log.Debug("Dont Allow submitTransaction to BlockSigners through api ", tx.String()) - return tx.Hash(), nil + return common.Hash{}, errors.New("Dont allow transaction sent to BlockSigners smart contract via API") } - log.Debug("Allow submitTransaction through api ", tx.String()) if err := b.SendTx(ctx, tx); err != nil { return common.Hash{}, err }