本文整理汇总了Golang中github.com/roasbeef/btcd/rpctest.Harness.RPCConfig方法的典型用法代码示例。如果您正苦于以下问题:Golang Harness.RPCConfig方法的具体用法?Golang Harness.RPCConfig怎么用?Golang Harness.RPCConfig使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/roasbeef/btcd/rpctest.Harness
的用法示例。
在下文中一共展示了Harness.RPCConfig方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: createTestWallet
// createTestWallet creates a test LightningWallet will a total of 20BTC
// available for funding channels.
func createTestWallet(miningNode *rpctest.Harness, netParams *chaincfg.Params) (string, *LightningWallet, error) {
privPass := []byte("private-test")
tempTestDir, err := ioutil.TempDir("", "lnwallet")
if err != nil {
return "", nil, nil
}
rpcConfig := miningNode.RPCConfig()
config := &Config{
PrivatePass: privPass,
HdSeed: testHdSeed[:],
DataDir: tempTestDir,
NetParams: netParams,
RpcHost: rpcConfig.Host,
RpcUser: rpcConfig.User,
RpcPass: rpcConfig.Pass,
CACert: rpcConfig.Certificates,
}
wallet, _, err := NewLightningWallet(config)
if err != nil {
return "", nil, err
}
if err := wallet.Startup(); err != nil {
return "", nil, err
}
// Load our test wallet with 5 outputs each holding 4BTC.
if err := loadTestCredits(miningNode, wallet, 5, 4); err != nil {
return "", nil, err
}
return tempTestDir, wallet, nil
}
示例2: InitializeSeedNodes
// InitializeSeedNodes initialized alice and bob nodes given an already
// running instance of btcd's rpctest harness and extra command line flags,
// which should be formatted properly - "--arg=value".
func (n *networkHarness) InitializeSeedNodes(r *rpctest.Harness, lndArgs []string) error {
nodeConfig := r.RPCConfig()
n.netParams = r.ActiveNet
n.Miner = r
n.rpcConfig = nodeConfig
var err error
n.Alice, err = newLightningNode(&nodeConfig, lndArgs)
if err != nil {
return err
}
n.Bob, err = newLightningNode(&nodeConfig, lndArgs)
if err != nil {
return err
}
n.activeNodes[n.Alice.nodeId] = n.Alice
n.activeNodes[n.Bob.nodeId] = n.Bob
return err
}