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/common"
|
||||||
"github.com/ethereum/go-ethereum/crypto"
|
"github.com/ethereum/go-ethereum/crypto"
|
||||||
"github.com/ethereum/go-ethereum/private"
|
"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
|
// 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 {
|
if constellationErr != nil {
|
||||||
return nil, constellationErr
|
return nil, constellationErr
|
||||||
}
|
}
|
||||||
private.P = constellation.MustNew(cfgFile.Name())
|
private.P = privatetransactionmanager.MustNew(cfgFile.Name())
|
||||||
return constellationCmd, nil
|
return constellationCmd, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1784,12 +1784,12 @@ func (s *PublicTransactionPoolAPI) send(ctx context.Context, asyncArgs AsyncSend
|
||||||
buf := new(bytes.Buffer)
|
buf := new(bytes.Buffer)
|
||||||
err := json.NewEncoder(buf).Encode(resultResponse)
|
err := json.NewEncoder(buf).Encode(resultResponse)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Info("Error encoding callback JSON: %v", err)
|
log.Info("Error encoding callback JSON", "err", err.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
_, err = http.Post(asyncArgs.CallbackUrl, "application/json", buf)
|
_, err = http.Post(asyncArgs.CallbackUrl, "application/json", buf)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Info("Error sending callback: %v", err)
|
log.Info("Error sending callback", "err", err.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -501,7 +501,21 @@ web3._extend({
|
||||||
call: 'eth_storageRoot',
|
call: 'eth_storageRoot',
|
||||||
params: 2,
|
params: 2,
|
||||||
inputFormatter: [web3._extend.formatters.inputAddressFormatter, null]
|
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: [
|
properties: [
|
||||||
new web3._extend.Property({
|
new web3._extend.Property({
|
||||||
|
|
|
@ -3,7 +3,7 @@ package private
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/private/constellation"
|
"github.com/ethereum/go-ethereum/private/privatetransactionmanager"
|
||||||
)
|
)
|
||||||
|
|
||||||
type PrivateTransactionManager interface {
|
type PrivateTransactionManager interface {
|
||||||
|
@ -17,7 +17,7 @@ func FromEnvironmentOrNil(name string) PrivateTransactionManager {
|
||||||
if cfgPath == "" {
|
if cfgPath == "" {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return constellation.MustNew(cfgPath)
|
return privatetransactionmanager.MustNew(cfgPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
var P = FromEnvironmentOrNil("PRIVATE_CONFIG")
|
var P = FromEnvironmentOrNil("PRIVATE_CONFIG")
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package constellation
|
package privatetransactionmanager
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/BurntSushi/toml"
|
"github.com/BurntSushi/toml"
|
|
@ -1,4 +1,4 @@
|
||||||
package constellation
|
package privatetransactionmanager
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
@ -56,7 +56,7 @@ func RunNode(socketPath string) error {
|
||||||
if res.StatusCode == 200 {
|
if res.StatusCode == 200 {
|
||||||
return nil
|
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 {
|
type Client struct {
|
|
@ -1,4 +1,4 @@
|
||||||
package constellation
|
package privatetransactionmanager
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
@ -11,18 +11,18 @@ import (
|
||||||
"github.com/patrickmn/go-cache"
|
"github.com/patrickmn/go-cache"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Constellation struct {
|
type PrivateTransactionManager struct {
|
||||||
node *Client
|
node *Client
|
||||||
c *cache.Cache
|
c *cache.Cache
|
||||||
isConstellationNotInUse bool
|
isPrivateTransactionManagerNotInUse bool
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
errPrivateTransactionManagerNotUsed = errors.New("private transaction manager not in use")
|
errPrivateTransactionManagerNotUsed = errors.New("private transaction manager not in use")
|
||||||
)
|
)
|
||||||
|
|
||||||
func (g *Constellation) Send(data []byte, from string, to []string) (out []byte, err error) {
|
func (g *PrivateTransactionManager) Send(data []byte, from string, to []string) (out []byte, err error) {
|
||||||
if g.isConstellationNotInUse {
|
if g.isPrivateTransactionManagerNotInUse {
|
||||||
return nil, errPrivateTransactionManagerNotUsed
|
return nil, errPrivateTransactionManagerNotUsed
|
||||||
}
|
}
|
||||||
out, err = g.node.SendPayload(data, from, to)
|
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
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *Constellation) SendSignedTx(data []byte, to []string) (out []byte, err error) {
|
func (g *PrivateTransactionManager) SendSignedTx(data []byte, to []string) (out []byte, err error) {
|
||||||
if g.isConstellationNotInUse {
|
if g.isPrivateTransactionManagerNotInUse {
|
||||||
return nil, errPrivateTransactionManagerNotUsed
|
return nil, errPrivateTransactionManagerNotUsed
|
||||||
}
|
}
|
||||||
out, err = g.node.SendSignedPayload(data, to)
|
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
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *Constellation) Receive(data []byte) ([]byte, error) {
|
func (g *PrivateTransactionManager) Receive(data []byte) ([]byte, error) {
|
||||||
if g.isConstellationNotInUse {
|
if g.isPrivateTransactionManagerNotInUse {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
if len(data) == 0 {
|
if len(data) == 0 {
|
||||||
|
@ -65,7 +65,7 @@ func (g *Constellation) Receive(data []byte) ([]byte, error) {
|
||||||
return pl, nil
|
return pl, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func New(path string) (*Constellation, error) {
|
func New(path string) (*PrivateTransactionManager, error) {
|
||||||
info, err := os.Lstat(path)
|
info, err := os.Lstat(path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -88,24 +88,24 @@ func New(path string) (*Constellation, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return &Constellation{
|
return &PrivateTransactionManager{
|
||||||
node: n,
|
node: n,
|
||||||
c: cache.New(5*time.Minute, 5*time.Minute),
|
c: cache.New(5*time.Minute, 5*time.Minute),
|
||||||
isConstellationNotInUse: false,
|
isPrivateTransactionManagerNotInUse: false,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func MustNew(path string) *Constellation {
|
func MustNew(path string) *PrivateTransactionManager {
|
||||||
if strings.EqualFold(path, "ignore") {
|
if strings.EqualFold(path, "ignore") {
|
||||||
return &Constellation{
|
return &PrivateTransactionManager{
|
||||||
node: nil,
|
node: nil,
|
||||||
c: nil,
|
c: nil,
|
||||||
isConstellationNotInUse: true,
|
isPrivateTransactionManagerNotInUse: true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
g, err := New(path)
|
g, err := New(path)
|
||||||
if err != nil {
|
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
|
return g
|
||||||
}
|
}
|
Loading…
Reference in New Issue