change some log , return error to user

This commit is contained in:
Nguyen Ba Tam 2018-08-11 15:30:29 +07:00
parent b2ed6dce8b
commit 47d25bf2c3

View file

@ -1209,10 +1209,8 @@ func (args *SendTxArgs) toTransaction() *types.Transaction {
// submitTransaction is a helper function that submits tx to txPool and logs a message. // 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) { func submitTransaction(ctx context.Context, b Backend, tx *types.Transaction) (common.Hash, error) {
if tx.To() != nil && tx.To().String() == common.BlockSigners { if tx.To() != nil && tx.To().String() == common.BlockSigners {
log.Debug("Dont Allow submitTransaction to BlockSigners through api ", tx.String()) return common.Hash{}, errors.New("Dont allow transaction sent to BlockSigners smart contract via API")
return tx.Hash(), nil
} }
log.Debug("Allow submitTransaction through api ", tx.String())
if err := b.SendTx(ctx, tx); err != nil { if err := b.SendTx(ctx, tx); err != nil {
return common.Hash{}, err return common.Hash{}, err
} }