accounts, cmd, internal, node: implement HD wallet self-derivation

This commit is contained in:
Péter Szilágyi
2017-02-08 20:25:52 +02:00
parent c5215fdd48
commit 205ea95802
9 changed files with 383 additions and 136 deletions

View File

@ -19,6 +19,7 @@ package keystore
import (
"math/big"
ethereum "github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/accounts"
"github.com/ethereum/go-ethereum/core/types"
)
@ -69,10 +70,14 @@ func (w *keystoreWallet) Contains(account accounts.Account) bool {
// Derive implements accounts.Wallet, but is a noop for plain wallets since there
// is no notion of hierarchical account derivation for plain keystore accounts.
func (w *keystoreWallet) Derive(path string, pin bool) (accounts.Account, error) {
func (w *keystoreWallet) Derive(path accounts.DerivationPath, pin bool) (accounts.Account, error) {
return accounts.Account{}, accounts.ErrNotSupported
}
// SelfDerive implements accounts.Wallet, but is a noop for plain wallets since
// there is no notion of hierarchical account derivation for plain keystore accounts.
func (w *keystoreWallet) SelfDerive(base accounts.DerivationPath, chain ethereum.ChainStateReader) {}
// SignHash implements accounts.Wallet, attempting to sign the given hash with
// the given account. If the wallet does not wrap this particular account, an
// error is returned to avoid account leakage (even though in theory we may be