lnwallet: add a BtcWallet implementation of WalletController

This commit adds the first concrete implementation of the
WalletController interface: BtcWallet. This implementation is simply a
series of wrapper functions are the base btcwallet struct.

Additionally, for ease of use both the BlockChain IO and Signer
interface are also implemented by BtcWallet. Finally a new WalletDriver
implementation has been implemented, and will be register by the init()
method within this new package.
This commit is contained in:
Olaoluwa Osuntokun
2016-08-12 15:29:38 -07:00
parent 5449ba2b34
commit 6a1d8d0682
6 changed files with 759 additions and 56 deletions

View File

@@ -1,60 +1,15 @@
package lnwallet
import (
"path/filepath"
"github.com/roasbeef/btcd/chaincfg"
"github.com/roasbeef/btcutil"
)
var (
// TODO(roasbeef): lnwallet config file
lnwalletHomeDir = btcutil.AppDataDir("lnwallet", false)
defaultDataDir = lnwalletHomeDir
defaultLogFilename = "lnwallet.log"
defaultLogDirname = "logs"
defaultLogDir = filepath.Join(lnwalletHomeDir, defaultLogDirname)
btcdHomeDir = btcutil.AppDataDir("btcd", false)
btcdHomedirCAFile = filepath.Join(btcdHomeDir, "rpc.cert")
defaultRPCKeyFile = filepath.Join(lnwalletHomeDir, "rpc.key")
defaultRPCCertFile = filepath.Join(lnwalletHomeDir, "rpc.cert")
// defaultPubPassphrase is the default public wallet passphrase which is
// used when the user indicates they do not want additional protection
// provided by having all public data in the wallet encrypted by a
// passphrase only known to them.
defaultPubPassphrase = []byte("public")
walletDbName = "lnwallet.db"
)
// Config...
// Config..
type Config struct {
DataDir string
LogDir string
DebugLevel string
RpcHost string // localhost:18334
RpcUser string
RpcPass string
RpcNoTLS bool
RPCCert string
RPCKey string
CACert []byte
PrivatePass []byte
PublicPass []byte
HdSeed []byte
// Which bitcoin network are we using?
NetParams *chaincfg.Params
}
// setDefaults...
func setDefaults(confg *Config) {
// default csv time
// default cltv time
// default wait for funding time
// default wait for closure time
// min amount to accept channel
// min fee imformation
// * or possibly interface to predict fees
// max htlcs in flight?
// possible secret derivation functions
//
}