mirror of https://github.com/poanetwork/quorum.git
Merge branch 'master' into docs/AWSSecretsManagerKeyVault
This commit is contained in:
commit
074c6631f5
|
@ -20,7 +20,7 @@ import (
|
|||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/crypto"
|
||||
"github.com/ethereum/go-ethereum/private"
|
||||
"github.com/ethereum/go-ethereum/private/constellation"
|
||||
"github.com/ethereum/go-ethereum/private/privatetransactionmanager"
|
||||
)
|
||||
|
||||
// callmsg is the message type used for call transactions in the private state test
|
||||
|
@ -128,7 +128,7 @@ func runConstellation() (*osExec.Cmd, error) {
|
|||
if constellationErr != nil {
|
||||
return nil, constellationErr
|
||||
}
|
||||
private.P = constellation.MustNew(cfgFile.Name())
|
||||
private.P = privatetransactionmanager.MustNew(cfgFile.Name())
|
||||
return constellationCmd, nil
|
||||
}
|
||||
|
||||
|
|
|
@ -1784,12 +1784,12 @@ func (s *PublicTransactionPoolAPI) send(ctx context.Context, asyncArgs AsyncSend
|
|||
buf := new(bytes.Buffer)
|
||||
err := json.NewEncoder(buf).Encode(resultResponse)
|
||||
if err != nil {
|
||||
log.Info("Error encoding callback JSON: %v", err)
|
||||
log.Info("Error encoding callback JSON", "err", err.Error())
|
||||
return
|
||||
}
|
||||
_, err = http.Post(asyncArgs.CallbackUrl, "application/json", buf)
|
||||
if err != nil {
|
||||
log.Info("Error sending callback: %v", err)
|
||||
log.Info("Error sending callback", "err", err.Error())
|
||||
return
|
||||
}
|
||||
}
|
||||
|
|
|
@ -501,7 +501,21 @@ web3._extend({
|
|||
call: 'eth_storageRoot',
|
||||
params: 2,
|
||||
inputFormatter: [web3._extend.formatters.inputAddressFormatter, null]
|
||||
})
|
||||
}),
|
||||
// QUORUM
|
||||
new web3._extend.Method({
|
||||
name: 'sendTransactionAsync',
|
||||
call: 'eth_sendTransactionAsync',
|
||||
params: 1,
|
||||
inputFormatter: [web3._extend.formatters.inputTransactionFormatter]
|
||||
}),
|
||||
new web3._extend.Method({
|
||||
name: 'getQuorumPayload',
|
||||
call: 'eth_getQuorumPayload',
|
||||
params: 1,
|
||||
inputFormatter: [null]
|
||||
}),
|
||||
// END-QUORUM
|
||||
],
|
||||
properties: [
|
||||
new web3._extend.Property({
|
||||
|
|
|
@ -3,7 +3,7 @@ package private
|
|||
import (
|
||||
"os"
|
||||
|
||||
"github.com/ethereum/go-ethereum/private/constellation"
|
||||
"github.com/ethereum/go-ethereum/private/privatetransactionmanager"
|
||||
)
|
||||
|
||||
type PrivateTransactionManager interface {
|
||||
|
@ -17,7 +17,7 @@ func FromEnvironmentOrNil(name string) PrivateTransactionManager {
|
|||
if cfgPath == "" {
|
||||
return nil
|
||||
}
|
||||
return constellation.MustNew(cfgPath)
|
||||
return privatetransactionmanager.MustNew(cfgPath)
|
||||
}
|
||||
|
||||
var P = FromEnvironmentOrNil("PRIVATE_CONFIG")
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package constellation
|
||||
package privatetransactionmanager
|
||||
|
||||
import (
|
||||
"github.com/BurntSushi/toml"
|
|
@ -1,4 +1,4 @@
|
|||
package constellation
|
||||
package privatetransactionmanager
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
|
@ -56,7 +56,7 @@ func RunNode(socketPath string) error {
|
|||
if res.StatusCode == 200 {
|
||||
return nil
|
||||
}
|
||||
return errors.New("Constellation Node API did not respond to upcheck request")
|
||||
return errors.New("private transaction manager did not respond to upcheck request")
|
||||
}
|
||||
|
||||
type Client struct {
|
|
@ -1,4 +1,4 @@
|
|||
package constellation
|
||||
package privatetransactionmanager
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
@ -11,18 +11,18 @@ import (
|
|||
"github.com/patrickmn/go-cache"
|
||||
)
|
||||
|
||||
type Constellation struct {
|
||||
type PrivateTransactionManager struct {
|
||||
node *Client
|
||||
c *cache.Cache
|
||||
isConstellationNotInUse bool
|
||||
isPrivateTransactionManagerNotInUse bool
|
||||
}
|
||||
|
||||
var (
|
||||
errPrivateTransactionManagerNotUsed = errors.New("private transaction manager not in use")
|
||||
)
|
||||
|
||||
func (g *Constellation) Send(data []byte, from string, to []string) (out []byte, err error) {
|
||||
if g.isConstellationNotInUse {
|
||||
func (g *PrivateTransactionManager) Send(data []byte, from string, to []string) (out []byte, err error) {
|
||||
if g.isPrivateTransactionManagerNotInUse {
|
||||
return nil, errPrivateTransactionManagerNotUsed
|
||||
}
|
||||
out, err = g.node.SendPayload(data, from, to)
|
||||
|
@ -33,8 +33,8 @@ func (g *Constellation) Send(data []byte, from string, to []string) (out []byte,
|
|||
return out, nil
|
||||
}
|
||||
|
||||
func (g *Constellation) SendSignedTx(data []byte, to []string) (out []byte, err error) {
|
||||
if g.isConstellationNotInUse {
|
||||
func (g *PrivateTransactionManager) SendSignedTx(data []byte, to []string) (out []byte, err error) {
|
||||
if g.isPrivateTransactionManagerNotInUse {
|
||||
return nil, errPrivateTransactionManagerNotUsed
|
||||
}
|
||||
out, err = g.node.SendSignedPayload(data, to)
|
||||
|
@ -44,8 +44,8 @@ func (g *Constellation) SendSignedTx(data []byte, to []string) (out []byte, err
|
|||
return out, nil
|
||||
}
|
||||
|
||||
func (g *Constellation) Receive(data []byte) ([]byte, error) {
|
||||
if g.isConstellationNotInUse {
|
||||
func (g *PrivateTransactionManager) Receive(data []byte) ([]byte, error) {
|
||||
if g.isPrivateTransactionManagerNotInUse {
|
||||
return nil, nil
|
||||
}
|
||||
if len(data) == 0 {
|
||||
|
@ -65,7 +65,7 @@ func (g *Constellation) Receive(data []byte) ([]byte, error) {
|
|||
return pl, nil
|
||||
}
|
||||
|
||||
func New(path string) (*Constellation, error) {
|
||||
func New(path string) (*PrivateTransactionManager, error) {
|
||||
info, err := os.Lstat(path)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -88,24 +88,24 @@ func New(path string) (*Constellation, error) {
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &Constellation{
|
||||
return &PrivateTransactionManager{
|
||||
node: n,
|
||||
c: cache.New(5*time.Minute, 5*time.Minute),
|
||||
isConstellationNotInUse: false,
|
||||
isPrivateTransactionManagerNotInUse: false,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func MustNew(path string) *Constellation {
|
||||
func MustNew(path string) *PrivateTransactionManager {
|
||||
if strings.EqualFold(path, "ignore") {
|
||||
return &Constellation{
|
||||
return &PrivateTransactionManager{
|
||||
node: nil,
|
||||
c: nil,
|
||||
isConstellationNotInUse: true,
|
||||
isPrivateTransactionManagerNotInUse: true,
|
||||
}
|
||||
}
|
||||
g, err := New(path)
|
||||
if err != nil {
|
||||
panic(fmt.Sprintf("MustNew: Failed to connect to Constellation (%s): %v", path, err))
|
||||
panic(fmt.Sprintf("MustNew: Failed to connect to private transaction manager (%s): %v", path, err))
|
||||
}
|
||||
return g
|
||||
}
|
Loading…
Reference in New Issue