diff --git a/accounts/keystore/keystore.go b/accounts/keystore/keystore.go index 10c0db70f..fa04214c2 100644 --- a/accounts/keystore/keystore.go +++ b/accounts/keystore/keystore.go @@ -278,7 +278,7 @@ func (ks *KeyStore) SignTx(a accounts.Account, tx *types.Transaction, chainID *b return nil, ErrLocked } // Depending on the presence of the chain ID, sign with EIP155 or homestead - if chainID != nil && !isQuorum { + if chainID != nil && !tx.IsPrivate() { return types.SignTx(tx, types.NewEIP155Signer(chainID), unlockedKey.PrivateKey) } return types.SignTx(tx, types.HomesteadSigner{}, unlockedKey.PrivateKey) diff --git a/core/types/transaction.go b/core/types/transaction.go index 80335f1da..31f88ff14 100644 --- a/core/types/transaction.go +++ b/core/types/transaction.go @@ -133,9 +133,7 @@ func isProtectedV(V *big.Int) bool { if V.BitLen() <= 8 { v := V.Uint64() // 27 / 28 are pre eip 155 -- ie unprotected. - // TODO(joel): this is a hack. Everywhere else we maintain vanilla ethereum - // compatibility and we should figure out how to extend that to here - return !(v == 27 || v == 28 || v == 37 || v == 38) + return !(v == 27 || v == 28) } // anything not 27 or 28 are considered unprotected return true diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index e2106bd27..2e3e154c7 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -27,6 +27,9 @@ import ( "bytes" "encoding/hex" "encoding/json" + "net/http" + "sync" + "github.com/ethereum/go-ethereum/accounts" "github.com/ethereum/go-ethereum/accounts/keystore" "github.com/ethereum/go-ethereum/common" @@ -45,8 +48,6 @@ import ( "github.com/ethereum/go-ethereum/rpc" "github.com/syndtr/goleveldb/leveldb" "github.com/syndtr/goleveldb/leveldb/util" - "net/http" - "sync" ) const ( @@ -378,7 +379,7 @@ func (s *PrivateAccountAPI) SendTransaction(ctx context.Context, args SendTxArgs tx := args.toTransaction() var chainID *big.Int - if config := s.b.ChainConfig(); config.IsEIP155(s.b.CurrentBlock().Number()) { + if config := s.b.ChainConfig(); config.IsEIP155(s.b.CurrentBlock().Number()) && !isPrivate { chainID = config.ChainId } signed, err := wallet.SignTxWithPassphrase(account, passwd, tx, chainID) @@ -835,7 +836,7 @@ type RPCTransaction struct { func newRPCTransaction(tx *types.Transaction, blockHash common.Hash, blockNumber uint64, index uint64) *RPCTransaction { var signer types.Signer = types.HomesteadSigner{} // joel: this is one of the two places we used a wrong signer to print txes - if tx.Protected() { + if tx.Protected() && !tx.IsPrivate() { signer = types.NewEIP155Signer(tx.ChainId()) } from, _ := types.Sender(signer, tx) @@ -1005,7 +1006,7 @@ func (s *PublicTransactionPoolAPI) GetTransactionReceipt(hash common.Hash) (map[ receipt, _, _, _ := core.GetReceipt(s.b.ChainDb(), hash) // Old receipts don't have the lookup data available var signer types.Signer = types.HomesteadSigner{} - if tx.Protected() { + if tx.Protected() && !tx.IsPrivate() { signer = types.NewEIP155Signer(tx.ChainId()) } from, _ := types.Sender(signer, tx) @@ -1051,10 +1052,9 @@ func (s *PublicTransactionPoolAPI) sign(addr common.Address, tx *types.Transacti } // Request the wallet to sign the transaction var chainID *big.Int - isQuorum := false - if config := s.b.ChainConfig(); config.IsEIP155(s.b.CurrentBlock().Number()) { + isQuorum := tx.IsPrivate() + if config := s.b.ChainConfig(); config.IsEIP155(s.b.CurrentBlock().Number()) && !tx.IsPrivate() { chainID = config.ChainId - isQuorum = true } return wallet.SignTx(account, tx, chainID, isQuorum) } @@ -1169,10 +1169,9 @@ func (s *PublicTransactionPoolAPI) SendTransaction(ctx context.Context, args Sen tx := args.toTransaction() var chainID *big.Int - isQuorum := false - if config := s.b.ChainConfig(); config.IsEIP155(s.b.CurrentBlock().Number()) { + isQuorum := tx.IsPrivate() + if config := s.b.ChainConfig(); config.IsEIP155(s.b.CurrentBlock().Number()) && !isPrivate { chainID = config.ChainId - isQuorum = true } signed, err := wallet.SignTx(account, tx, chainID, isQuorum) if err != nil { @@ -1257,7 +1256,7 @@ func (s *PublicTransactionPoolAPI) PendingTransactions() ([]*RPCTransaction, err transactions := make([]*RPCTransaction, 0, len(pending)) for _, tx := range pending { var signer types.Signer = types.HomesteadSigner{} - if tx.Protected() { + if tx.Protected() && !tx.IsPrivate() { signer = types.NewEIP155Signer(tx.ChainId()) } from, _ := types.Sender(signer, tx) @@ -1285,7 +1284,7 @@ func (s *PublicTransactionPoolAPI) Resend(ctx context.Context, sendArgs SendTxAr for _, p := range pending { var signer types.Signer = types.HomesteadSigner{} - if p.Protected() { + if p.Protected() && !p.IsPrivate() { signer = types.NewEIP155Signer(p.ChainId()) } wantSigHash := signer.Hash(matchTx)