mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-18 01:43:47 +00:00
swarm: Add missing privatekey from swarm config w/o swap
This commit is contained in:
parent
8d7bf3f3ef
commit
de7454263d
2 changed files with 14 additions and 2 deletions
|
|
@ -63,6 +63,7 @@ type Config struct {
|
||||||
Cors string
|
Cors string
|
||||||
BzzAccount string
|
BzzAccount string
|
||||||
BootNodes string
|
BootNodes string
|
||||||
|
privateKey *ecdsa.PrivateKey
|
||||||
}
|
}
|
||||||
|
|
||||||
//create a default config with all parameters to set to defaults
|
//create a default config with all parameters to set to defaults
|
||||||
|
|
@ -113,5 +114,14 @@ func (self *Config) Init(prvKey *ecdsa.PrivateKey) {
|
||||||
if self.SwapEnabled {
|
if self.SwapEnabled {
|
||||||
self.Swap.Init(self.Contract, prvKey)
|
self.Swap.Init(self.Contract, prvKey)
|
||||||
}
|
}
|
||||||
|
self.privateKey = prvKey
|
||||||
self.StoreParams.Init(self.Path)
|
self.StoreParams.Init(self.Path)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (self *Config) ShiftPrivateKey() (privKey *ecdsa.PrivateKey) {
|
||||||
|
if self.privateKey != nil {
|
||||||
|
privKey = self.privateKey
|
||||||
|
self.privateKey = nil
|
||||||
|
}
|
||||||
|
return privKey
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ import (
|
||||||
"crypto/ecdsa"
|
"crypto/ecdsa"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net"
|
"net"
|
||||||
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/accounts/abi/bind"
|
"github.com/ethereum/go-ethereum/accounts/abi/bind"
|
||||||
|
|
@ -93,7 +94,7 @@ func NewSwarm(ctx *node.ServiceContext, backend chequebook.Backend, ensClient *e
|
||||||
self = &Swarm{
|
self = &Swarm{
|
||||||
config: config,
|
config: config,
|
||||||
backend: backend,
|
backend: backend,
|
||||||
privateKey: config.Swap.PrivateKey(),
|
privateKey: config.ShiftPrivateKey(),
|
||||||
}
|
}
|
||||||
log.Debug(fmt.Sprintf("Setting up Swarm service components"))
|
log.Debug(fmt.Sprintf("Setting up Swarm service components"))
|
||||||
|
|
||||||
|
|
@ -143,7 +144,8 @@ func NewSwarm(ctx *node.ServiceContext, backend chequebook.Backend, ensClient *e
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// set up high level api
|
// SET UP high level api
|
||||||
|
fmt.Fprintf(os.Stderr, "privkey %v\nswap %v\nswapendabled %v\n", self.privateKey, config.Swap, config.SwapEnabled)
|
||||||
transactOpts := bind.NewKeyedTransactor(self.privateKey)
|
transactOpts := bind.NewKeyedTransactor(self.privateKey)
|
||||||
|
|
||||||
if ensClient == nil {
|
if ensClient == nil {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue