mirror of
https://github.com/LBRYFoundation/lbcwallet.git
synced 2025-08-23 17:47:29 +00:00
multi: update due to latest API changes
This commit is contained in:
parent
e22bcf88df
commit
b0b64d3bbd
8 changed files with 44 additions and 77 deletions
|
@ -14,11 +14,11 @@ import (
|
||||||
"runtime"
|
"runtime"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/lightninglabs/neutrino"
|
|
||||||
"github.com/btcsuite/btcwallet/chain"
|
"github.com/btcsuite/btcwallet/chain"
|
||||||
"github.com/btcsuite/btcwallet/rpc/legacyrpc"
|
"github.com/btcsuite/btcwallet/rpc/legacyrpc"
|
||||||
"github.com/btcsuite/btcwallet/wallet"
|
"github.com/btcsuite/btcwallet/wallet"
|
||||||
"github.com/btcsuite/btcwallet/walletdb"
|
"github.com/btcsuite/btcwallet/walletdb"
|
||||||
|
"github.com/lightninglabs/neutrino"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -69,7 +69,7 @@ func walletMain() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
dbDir := networkDir(cfg.AppDataDir.Value, activeNet.Params)
|
dbDir := networkDir(cfg.AppDataDir.Value, activeNet.Params)
|
||||||
loader := wallet.NewLoader(activeNet.Params, dbDir)
|
loader := wallet.NewLoader(activeNet.Params, dbDir, 250)
|
||||||
|
|
||||||
// Create and start HTTP server to serve wallet client connections.
|
// Create and start HTTP server to serve wallet client connections.
|
||||||
// This will be updated with the wallet and chain server RPC client
|
// This will be updated with the wallet and chain server RPC client
|
||||||
|
@ -179,7 +179,7 @@ func rpcClientConnectLoop(legacyRPCServer *legacyrpc.Server, loader *wallet.Load
|
||||||
log.Errorf("Couldn't create Neutrino ChainService: %s", err)
|
log.Errorf("Couldn't create Neutrino ChainService: %s", err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
chainClient = chain.NewNeutrinoClient(chainService)
|
chainClient = chain.NewNeutrinoClient(activeNet.Params, chainService)
|
||||||
err = chainClient.Start()
|
err = chainClient.Start()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Errorf("Couldn't start Neutrino client: %s", err)
|
log.Errorf("Couldn't start Neutrino client: %s", err)
|
||||||
|
|
55
log.go
55
log.go
|
@ -10,6 +10,7 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
|
"github.com/btcsuite/btcd/rpcclient"
|
||||||
"github.com/btcsuite/btclog"
|
"github.com/btcsuite/btclog"
|
||||||
"github.com/btcsuite/btcwallet/chain"
|
"github.com/btcsuite/btcwallet/chain"
|
||||||
"github.com/btcsuite/btcwallet/rpc/legacyrpc"
|
"github.com/btcsuite/btcwallet/rpc/legacyrpc"
|
||||||
|
@ -26,7 +27,7 @@ type logWriter struct{}
|
||||||
|
|
||||||
func (logWriter) Write(p []byte) (n int, err error) {
|
func (logWriter) Write(p []byte) (n int, err error) {
|
||||||
os.Stdout.Write(p)
|
os.Stdout.Write(p)
|
||||||
logRotator.Write(p)
|
logRotatorPipe.Write(p)
|
||||||
return len(p), nil
|
return len(p), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,6 +49,10 @@ var (
|
||||||
// application shutdown.
|
// application shutdown.
|
||||||
logRotator *rotator.Rotator
|
logRotator *rotator.Rotator
|
||||||
|
|
||||||
|
// logRotatorPipe is the write-end pipe for writing to the log rotator. It
|
||||||
|
// is written to by the Write method of the logWriter type.
|
||||||
|
logRotatorPipe *io.PipeWriter
|
||||||
|
|
||||||
log = backendLog.Logger("BTCW")
|
log = backendLog.Logger("BTCW")
|
||||||
walletLog = backendLog.Logger("WLLT")
|
walletLog = backendLog.Logger("WLLT")
|
||||||
txmgrLog = backendLog.Logger("TMGR")
|
txmgrLog = backendLog.Logger("TMGR")
|
||||||
|
@ -88,54 +93,7 @@ func initLogRotator(logFile string) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Fprintf(os.Stderr, "failed to create log directory: %v\n", err)
|
fmt.Fprintf(os.Stderr, "failed to create log directory: %v\n", err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
// logClosure is used to provide a closure over expensive logging operations
|
|
||||||
// so don't have to be performed when the logging level doesn't warrant it.
|
|
||||||
type logClosure func() string
|
|
||||||
|
|
||||||
// String invokes the underlying function and returns the result.
|
|
||||||
func (c logClosure) String() string {
|
|
||||||
return c()
|
|
||||||
}
|
|
||||||
|
|
||||||
// newLogClosure returns a new closure over a function that returns a string
|
|
||||||
// which itself provides a Stringer interface so that it can be used with the
|
|
||||||
// logging system.
|
|
||||||
func newLogClosure(c func() string) logClosure {
|
|
||||||
return logClosure(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
// useLogger updates the logger references for subsystemID to logger. Invalid
|
|
||||||
// subsystems are ignored.
|
|
||||||
func useLogger(subsystemID string, logger btclog.Logger) {
|
|
||||||
if _, ok := subsystemLoggers[subsystemID]; !ok {
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
subsystemLoggers[subsystemID] = logger
|
|
||||||
|
|
||||||
switch subsystemID {
|
|
||||||
case "BTCW":
|
|
||||||
log = logger
|
|
||||||
case "WLLT":
|
|
||||||
walletLog = logger
|
|
||||||
wallet.UseLogger(logger)
|
|
||||||
case "TXST":
|
|
||||||
txmgrLog = logger
|
|
||||||
wtxmgr.UseLogger(logger)
|
|
||||||
case "CHNS":
|
|
||||||
chainLog = logger
|
|
||||||
chain.UseLogger(logger)
|
|
||||||
btcrpcclient.UseLogger(logger)
|
|
||||||
case "GRPC":
|
|
||||||
grpcLog = logger
|
|
||||||
rpcserver.UseLogger(logger)
|
|
||||||
case "RPCS":
|
|
||||||
legacyRPCLog = logger
|
|
||||||
legacyrpc.UseLogger(logger)
|
|
||||||
case "BTCN":
|
|
||||||
btcnLog = logger
|
|
||||||
neutrino.UseLogger(logger)
|
|
||||||
}
|
|
||||||
|
|
||||||
r, err := rotator.New(logFile, 10*1024, false, 3)
|
r, err := rotator.New(logFile, 10*1024, false, 3)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Fprintf(os.Stderr, "failed to create file rotator: %v\n", err)
|
fmt.Fprintf(os.Stderr, "failed to create file rotator: %v\n", err)
|
||||||
|
@ -146,6 +104,7 @@ func useLogger(subsystemID string, logger btclog.Logger) {
|
||||||
go r.Run(pr)
|
go r.Run(pr)
|
||||||
|
|
||||||
logRotator = r
|
logRotator = r
|
||||||
|
logRotatorPipe = pw
|
||||||
}
|
}
|
||||||
|
|
||||||
// setLogLevel sets the logging level for provided subsystem. Invalid
|
// setLogLevel sets the logging level for provided subsystem. Invalid
|
||||||
|
|
|
@ -1711,7 +1711,7 @@ func signRawTransaction(icmd interface{}, w *wallet.Wallet, chainClient *chain.R
|
||||||
// `complete' denotes that we successfully signed all outputs and that
|
// `complete' denotes that we successfully signed all outputs and that
|
||||||
// all scripts will run to completion. This is returned as part of the
|
// all scripts will run to completion. This is returned as part of the
|
||||||
// reply.
|
// reply.
|
||||||
signErrs, err := w.SignTransaction(tx, hashType, inputs, keys, scripts)
|
signErrs, err := w.SignTransaction(&tx, hashType, inputs, keys, scripts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -722,7 +722,9 @@ func (s *loaderServer) CreateWallet(ctx context.Context, req *pb.CreateWalletReq
|
||||||
pubPassphrase = []byte(wallet.InsecurePubPassphrase)
|
pubPassphrase = []byte(wallet.InsecurePubPassphrase)
|
||||||
}
|
}
|
||||||
|
|
||||||
wallet, err := s.loader.CreateNewWallet(pubPassphrase, req.PrivatePassphrase, req.Seed)
|
wallet, err := s.loader.CreateNewWallet(
|
||||||
|
pubPassphrase, req.PrivatePassphrase, req.Seed, time.Now(),
|
||||||
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, translateError(err)
|
return nil, translateError(err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -735,7 +735,11 @@ func (p *Pool) addUsedAddr(ns, addrmgrNs walletdb.ReadWriteBucket, seriesID uint
|
||||||
// to have it in the used addresses DB but not in the address manager.
|
// to have it in the used addresses DB but not in the address manager.
|
||||||
// TODO: Decide how far back we want the addr manager to rescan and set the
|
// TODO: Decide how far back we want the addr manager to rescan and set the
|
||||||
// BlockStamp height according to that.
|
// BlockStamp height according to that.
|
||||||
_, err = p.manager.ImportScript(addrmgrNs, script, &waddrmgr.BlockStamp{})
|
manager, err := p.manager.FetchScopedKeyManager(waddrmgr.KeyScopeBIP0044)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
_, err = manager.ImportScript(addrmgrNs, script, &waddrmgr.BlockStamp{})
|
||||||
if err != nil && err.(waddrmgr.ManagerError).ErrorCode != waddrmgr.ErrDuplicateAddress {
|
if err != nil && err.(waddrmgr.ManagerError).ErrorCode != waddrmgr.ErrDuplicateAddress {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -368,7 +368,7 @@ func (tx *withdrawalTx) toMsgTx() *wire.MsgTx {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, i := range tx.inputs {
|
for _, i := range tx.inputs {
|
||||||
msgtx.AddTxIn(wire.NewTxIn(&i.OutPoint, []byte{}))
|
msgtx.AddTxIn(wire.NewTxIn(&i.OutPoint, []byte{}, nil))
|
||||||
}
|
}
|
||||||
return msgtx
|
return msgtx
|
||||||
}
|
}
|
||||||
|
@ -983,7 +983,7 @@ func signMultiSigUTXO(mgr *waddrmgr.Manager, addrmgrNs walletdb.ReadBucket, tx *
|
||||||
// given index, returning an error if it fails.
|
// given index, returning an error if it fails.
|
||||||
func validateSigScript(msgtx *wire.MsgTx, idx int, pkScript []byte) error {
|
func validateSigScript(msgtx *wire.MsgTx, idx int, pkScript []byte) error {
|
||||||
vm, err := txscript.NewEngine(pkScript, msgtx, idx,
|
vm, err := txscript.NewEngine(pkScript, msgtx, idx,
|
||||||
txscript.StandardVerifyFlags, nil)
|
txscript.StandardVerifyFlags, nil, nil, 0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return newError(ErrTxSigning, "cannot create script engine", err)
|
return newError(ErrTxSigning, "cannot create script engine", err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,15 +28,17 @@ func makeInputSource(unspents []*wire.TxOut) InputSource {
|
||||||
// Return outputs in order.
|
// Return outputs in order.
|
||||||
currentTotal := btcutil.Amount(0)
|
currentTotal := btcutil.Amount(0)
|
||||||
currentInputs := make([]*wire.TxIn, 0, len(unspents))
|
currentInputs := make([]*wire.TxIn, 0, len(unspents))
|
||||||
f := func(target btcutil.Amount) (btcutil.Amount, []*wire.TxIn, [][]byte, error) {
|
currentInputValues := make([]btcutil.Amount, 0, len(unspents))
|
||||||
|
f := func(target btcutil.Amount) (btcutil.Amount, []*wire.TxIn, []btcutil.Amount, [][]byte, error) {
|
||||||
for currentTotal < target && len(unspents) != 0 {
|
for currentTotal < target && len(unspents) != 0 {
|
||||||
u := unspents[0]
|
u := unspents[0]
|
||||||
unspents = unspents[1:]
|
unspents = unspents[1:]
|
||||||
nextInput := wire.NewTxIn(&wire.OutPoint{}, nil)
|
nextInput := wire.NewTxIn(&wire.OutPoint{}, nil, nil)
|
||||||
currentTotal += btcutil.Amount(u.Value)
|
currentTotal += btcutil.Amount(u.Value)
|
||||||
currentInputs = append(currentInputs, nextInput)
|
currentInputs = append(currentInputs, nextInput)
|
||||||
|
currentInputValues = append(currentInputValues, btcutil.Amount(u.Value))
|
||||||
}
|
}
|
||||||
return currentTotal, currentInputs, make([][]byte, len(currentInputs)), nil
|
return currentTotal, currentInputs, currentInputValues, make([][]byte, len(currentInputs)), nil
|
||||||
}
|
}
|
||||||
return InputSource(f)
|
return InputSource(f)
|
||||||
}
|
}
|
||||||
|
@ -61,7 +63,7 @@ func TestNewUnsignedTransaction(t *testing.T) {
|
||||||
Outputs: p2pkhOutputs(1e6),
|
Outputs: p2pkhOutputs(1e6),
|
||||||
RelayFee: 1e3,
|
RelayFee: 1e3,
|
||||||
ChangeAmount: 1e8 - 1e6 - txrules.FeeForSerializeSize(1e3,
|
ChangeAmount: 1e8 - 1e6 - txrules.FeeForSerializeSize(1e3,
|
||||||
txsizes.EstimateSerializeSize(1, p2pkhOutputs(1e6), true)),
|
txsizes.EstimateVirtualSize(1, 0, 0, p2pkhOutputs(1e6), true)),
|
||||||
InputCount: 1,
|
InputCount: 1,
|
||||||
},
|
},
|
||||||
2: {
|
2: {
|
||||||
|
@ -69,7 +71,7 @@ func TestNewUnsignedTransaction(t *testing.T) {
|
||||||
Outputs: p2pkhOutputs(1e6),
|
Outputs: p2pkhOutputs(1e6),
|
||||||
RelayFee: 1e4,
|
RelayFee: 1e4,
|
||||||
ChangeAmount: 1e8 - 1e6 - txrules.FeeForSerializeSize(1e4,
|
ChangeAmount: 1e8 - 1e6 - txrules.FeeForSerializeSize(1e4,
|
||||||
txsizes.EstimateSerializeSize(1, p2pkhOutputs(1e6), true)),
|
txsizes.EstimateVirtualSize(1, 0, 0, p2pkhOutputs(1e6), true)),
|
||||||
InputCount: 1,
|
InputCount: 1,
|
||||||
},
|
},
|
||||||
3: {
|
3: {
|
||||||
|
@ -77,7 +79,7 @@ func TestNewUnsignedTransaction(t *testing.T) {
|
||||||
Outputs: p2pkhOutputs(1e6, 1e6, 1e6),
|
Outputs: p2pkhOutputs(1e6, 1e6, 1e6),
|
||||||
RelayFee: 1e4,
|
RelayFee: 1e4,
|
||||||
ChangeAmount: 1e8 - 3e6 - txrules.FeeForSerializeSize(1e4,
|
ChangeAmount: 1e8 - 3e6 - txrules.FeeForSerializeSize(1e4,
|
||||||
txsizes.EstimateSerializeSize(1, p2pkhOutputs(1e6, 1e6, 1e6), true)),
|
txsizes.EstimateVirtualSize(1, 0, 0, p2pkhOutputs(1e6, 1e6, 1e6), true)),
|
||||||
InputCount: 1,
|
InputCount: 1,
|
||||||
},
|
},
|
||||||
4: {
|
4: {
|
||||||
|
@ -85,7 +87,7 @@ func TestNewUnsignedTransaction(t *testing.T) {
|
||||||
Outputs: p2pkhOutputs(1e6, 1e6, 1e6),
|
Outputs: p2pkhOutputs(1e6, 1e6, 1e6),
|
||||||
RelayFee: 2.55e3,
|
RelayFee: 2.55e3,
|
||||||
ChangeAmount: 1e8 - 3e6 - txrules.FeeForSerializeSize(2.55e3,
|
ChangeAmount: 1e8 - 3e6 - txrules.FeeForSerializeSize(2.55e3,
|
||||||
txsizes.EstimateSerializeSize(1, p2pkhOutputs(1e6, 1e6, 1e6), true)),
|
txsizes.EstimateVirtualSize(1, 0, 0, p2pkhOutputs(1e6, 1e6, 1e6), true)),
|
||||||
InputCount: 1,
|
InputCount: 1,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -93,15 +95,15 @@ func TestNewUnsignedTransaction(t *testing.T) {
|
||||||
5: {
|
5: {
|
||||||
UnspentOutputs: p2pkhOutputs(1e8),
|
UnspentOutputs: p2pkhOutputs(1e8),
|
||||||
Outputs: p2pkhOutputs(1e8 - 545 - txrules.FeeForSerializeSize(1e3,
|
Outputs: p2pkhOutputs(1e8 - 545 - txrules.FeeForSerializeSize(1e3,
|
||||||
txsizes.EstimateSerializeSize(1, p2pkhOutputs(0), true))),
|
txsizes.EstimateVirtualSize(1, 0, 0, p2pkhOutputs(0), true))),
|
||||||
RelayFee: 1e3,
|
RelayFee: 1e3,
|
||||||
ChangeAmount: 0,
|
ChangeAmount: 545,
|
||||||
InputCount: 1,
|
InputCount: 1,
|
||||||
},
|
},
|
||||||
6: {
|
6: {
|
||||||
UnspentOutputs: p2pkhOutputs(1e8),
|
UnspentOutputs: p2pkhOutputs(1e8),
|
||||||
Outputs: p2pkhOutputs(1e8 - 546 - txrules.FeeForSerializeSize(1e3,
|
Outputs: p2pkhOutputs(1e8 - 546 - txrules.FeeForSerializeSize(1e3,
|
||||||
txsizes.EstimateSerializeSize(1, p2pkhOutputs(0), true))),
|
txsizes.EstimateVirtualSize(1, 0, 0, p2pkhOutputs(0), true))),
|
||||||
RelayFee: 1e3,
|
RelayFee: 1e3,
|
||||||
ChangeAmount: 546,
|
ChangeAmount: 546,
|
||||||
InputCount: 1,
|
InputCount: 1,
|
||||||
|
@ -111,15 +113,15 @@ func TestNewUnsignedTransaction(t *testing.T) {
|
||||||
7: {
|
7: {
|
||||||
UnspentOutputs: p2pkhOutputs(1e8),
|
UnspentOutputs: p2pkhOutputs(1e8),
|
||||||
Outputs: p2pkhOutputs(1e8 - 1392 - txrules.FeeForSerializeSize(2.55e3,
|
Outputs: p2pkhOutputs(1e8 - 1392 - txrules.FeeForSerializeSize(2.55e3,
|
||||||
txsizes.EstimateSerializeSize(1, p2pkhOutputs(0), true))),
|
txsizes.EstimateVirtualSize(1, 0, 0, p2pkhOutputs(0), true))),
|
||||||
RelayFee: 2.55e3,
|
RelayFee: 2.55e3,
|
||||||
ChangeAmount: 0,
|
ChangeAmount: 1392,
|
||||||
InputCount: 1,
|
InputCount: 1,
|
||||||
},
|
},
|
||||||
8: {
|
8: {
|
||||||
UnspentOutputs: p2pkhOutputs(1e8),
|
UnspentOutputs: p2pkhOutputs(1e8),
|
||||||
Outputs: p2pkhOutputs(1e8 - 1393 - txrules.FeeForSerializeSize(2.55e3,
|
Outputs: p2pkhOutputs(1e8 - 1393 - txrules.FeeForSerializeSize(2.55e3,
|
||||||
txsizes.EstimateSerializeSize(1, p2pkhOutputs(0), true))),
|
txsizes.EstimateVirtualSize(1, 0, 0, p2pkhOutputs(0), true))),
|
||||||
RelayFee: 2.55e3,
|
RelayFee: 2.55e3,
|
||||||
ChangeAmount: 1393,
|
ChangeAmount: 1393,
|
||||||
InputCount: 1,
|
InputCount: 1,
|
||||||
|
@ -131,7 +133,7 @@ func TestNewUnsignedTransaction(t *testing.T) {
|
||||||
9: {
|
9: {
|
||||||
UnspentOutputs: p2pkhOutputs(1e8, 1e8),
|
UnspentOutputs: p2pkhOutputs(1e8, 1e8),
|
||||||
Outputs: p2pkhOutputs(1e8 - 546 - txrules.FeeForSerializeSize(1e3,
|
Outputs: p2pkhOutputs(1e8 - 546 - txrules.FeeForSerializeSize(1e3,
|
||||||
txsizes.EstimateSerializeSize(1, p2pkhOutputs(0), true))),
|
txsizes.EstimateVirtualSize(1, 0, 0, p2pkhOutputs(0), true))),
|
||||||
RelayFee: 1e3,
|
RelayFee: 1e3,
|
||||||
ChangeAmount: 546,
|
ChangeAmount: 546,
|
||||||
InputCount: 1,
|
InputCount: 1,
|
||||||
|
@ -145,9 +147,9 @@ func TestNewUnsignedTransaction(t *testing.T) {
|
||||||
10: {
|
10: {
|
||||||
UnspentOutputs: p2pkhOutputs(1e8, 1e8),
|
UnspentOutputs: p2pkhOutputs(1e8, 1e8),
|
||||||
Outputs: p2pkhOutputs(1e8 - 545 - txrules.FeeForSerializeSize(1e3,
|
Outputs: p2pkhOutputs(1e8 - 545 - txrules.FeeForSerializeSize(1e3,
|
||||||
txsizes.EstimateSerializeSize(1, p2pkhOutputs(0), true))),
|
txsizes.EstimateVirtualSize(1, 0, 0, p2pkhOutputs(0), true))),
|
||||||
RelayFee: 1e3,
|
RelayFee: 1e3,
|
||||||
ChangeAmount: 0,
|
ChangeAmount: 545,
|
||||||
InputCount: 1,
|
InputCount: 1,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -157,7 +159,7 @@ func TestNewUnsignedTransaction(t *testing.T) {
|
||||||
Outputs: p2pkhOutputs(1e8),
|
Outputs: p2pkhOutputs(1e8),
|
||||||
RelayFee: 1e3,
|
RelayFee: 1e3,
|
||||||
ChangeAmount: 1e8 - txrules.FeeForSerializeSize(1e3,
|
ChangeAmount: 1e8 - txrules.FeeForSerializeSize(1e3,
|
||||||
txsizes.EstimateSerializeSize(2, p2pkhOutputs(1e8), true)),
|
txsizes.EstimateVirtualSize(2, 0, 0, p2pkhOutputs(1e8), true)),
|
||||||
InputCount: 2,
|
InputCount: 2,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -174,7 +176,7 @@ func TestNewUnsignedTransaction(t *testing.T) {
|
||||||
|
|
||||||
changeSource := func() ([]byte, error) {
|
changeSource := func() ([]byte, error) {
|
||||||
// Only length matters for these tests.
|
// Only length matters for these tests.
|
||||||
return make([]byte, txsizes.P2PKHPkScriptSize), nil
|
return make([]byte, txsizes.P2WPKHPkScriptSize), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
for i, test := range tests {
|
for i, test := range tests {
|
||||||
|
|
|
@ -102,7 +102,7 @@ func convertLegacyKeystore(legacyKeyStore *keystore.Store, w *wallet.Wallet) err
|
||||||
// provided path.
|
// provided path.
|
||||||
func createWallet(cfg *config) error {
|
func createWallet(cfg *config) error {
|
||||||
dbDir := networkDir(cfg.AppDataDir.Value, activeNet.Params)
|
dbDir := networkDir(cfg.AppDataDir.Value, activeNet.Params)
|
||||||
loader := wallet.NewLoader(activeNet.Params, dbDir)
|
loader := wallet.NewLoader(activeNet.Params, dbDir, 250)
|
||||||
|
|
||||||
// When there is a legacy keystore, open it now to ensure any errors
|
// When there is a legacy keystore, open it now to ensure any errors
|
||||||
// don't end up exiting the process after the user has spent time
|
// don't end up exiting the process after the user has spent time
|
||||||
|
@ -193,7 +193,7 @@ func createWallet(cfg *config) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Println("Creating the wallet...")
|
fmt.Println("Creating the wallet...")
|
||||||
w, err := loader.CreateNewWallet(pubPass, privPass, seed)
|
w, err := loader.CreateNewWallet(pubPass, privPass, seed, time.Now())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -226,7 +226,7 @@ func createSimulationWallet(cfg *config) error {
|
||||||
defer db.Close()
|
defer db.Close()
|
||||||
|
|
||||||
// Create the wallet.
|
// Create the wallet.
|
||||||
err = wallet.Create(db, pubPass, privPass, nil, activeNet.Params)
|
err = wallet.Create(db, pubPass, privPass, nil, activeNet.Params, time.Now())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue