multi: fix go vet warnings throughout code base

This commit is contained in:
Olaoluwa Osuntokun committed 2017-02-16 19:33:19 +08:00
1 parent 55e693aa09
commit 384fe61e73
12 files changed
+52 -81

No files matched your search

+18 -8
View File
@@ -94,8 +94,6 @@ func assertChannelOpen(t *testing.T, miner *rpctest.Harness, numConfs uint32,
t.Fatalf("channel never opened")
return nil
}
return nil
}
// bobNode represents the other party involved as a node within LN. Bob is our
@@ -210,7 +208,10 @@ func newBobNode(miner *rpctest.Harness, amt btcutil.Amount) (*bobNode, error) {
}
// Give bobNode one 7 BTC output for use in creating channels.
output := &wire.TxOut{7e8, bobAddrScript}
output := &wire.TxOut{
Value: 7e8,
PkScript: bobAddrScript,
}
mainTxid, err := miner.SendOutputs([]*wire.TxOut{output}, 10)
if err != nil {
return nil, err
@@ -284,7 +285,10 @@ func loadTestCredits(miner *rpctest.Harness, w *lnwallet.LightningWallet, numOut
addrs = append(addrs, walletAddr)
output := &wire.TxOut{satoshiPerOutput, script}
output := &wire.TxOut{
Value: satoshiPerOutput,
PkScript: script,
}
if _, err := miner.SendOutputs([]*wire.TxOut{output}, 10); err != nil {
return err
}
@@ -949,7 +953,10 @@ func testListTransactionDetails(miner *rpctest.Harness, wallet *lnwallet.Lightni
t.Fatalf("unable to create output script: %v", err)
}
output := &wire.TxOut{outputAmt, script}
output := &wire.TxOut{
Value: outputAmt,
PkScript: script,
}
txid, err := miner.SendOutputs([]*wire.TxOut{output}, 10)
if err != nil {
t.Fatalf("unable to send coinbase: %v", err)
@@ -1044,7 +1051,7 @@ func testListTransactionDetails(miner *rpctest.Harness, wallet *lnwallet.Lightni
}
}
if !burnTxFound {
t.Fatalf("tx burning btc not found")
t.Fatal("tx burning btc not found")
}
}
@@ -1056,7 +1063,7 @@ func testTransactionSubscriptions(miner *rpctest.Harness, w *lnwallet.LightningW
// implementation of the WalletController.
txClient, err := w.SubscribeTransactions()
if err != nil {
t.Fatalf("unable to generate tx subscription: %v")
t.Fatalf("unable to generate tx subscription: %v", err)
}
defer txClient.Cancel()
@@ -1097,7 +1104,10 @@ func testTransactionSubscriptions(miner *rpctest.Harness, w *lnwallet.LightningW
t.Fatalf("unable to create output script: %v", err)
}
output := &wire.TxOut{outputAmt, script}
output := &wire.TxOut{
Value: outputAmt,
PkScript: script,
}
if _, err := miner.SendOutputs([]*wire.TxOut{output}, 10); err != nil {
t.Fatalf("unable to send coinbase: %v", err)
}
+14 -8
View File
@@ -65,10 +65,16 @@ func TestCommitmentSpendValidation(t *testing.T) {
// transaction which sweeps the funds to a random address.
targetOutput, err := commitScriptUnencumbered(aliceKeyPub)
if err != nil {
t.Fatalf("unable to create target output: %v")
t.Fatalf("unable to create target output: %v", err)
}
sweepTx := wire.NewMsgTx(2)
sweepTx.AddTxIn(wire.NewTxIn(&wire.OutPoint{commitmentTx.TxHash(), 0}, nil, nil))
sweepTx.AddTxIn(wire.NewTxIn(&wire.OutPoint{
Hash: commitmentTx.TxHash(),
Index: 0,
},
nil,
nil),
)
sweepTx.AddTxOut(&wire.TxOut{
PkScript: targetOutput,
Value: 0.5 * 10e8,
@@ -77,7 +83,7 @@ func TestCommitmentSpendValidation(t *testing.T) {
// First, we'll test spending with Alice's key after the timeout.
delayScript, err := commitScriptToSelf(csvTimeout, aliceKeyPub, revokePubKey)
if err != nil {
t.Fatalf("unable to generate alice delay script: %v")
t.Fatalf("unable to generate alice delay script: %v", err)
}
sweepTx.TxIn[0].Sequence = lockTimeToSequence(false, csvTimeout)
signDesc := &SignDescriptor{
@@ -92,7 +98,7 @@ func TestCommitmentSpendValidation(t *testing.T) {
aliceWitnessSpend, err := CommitSpendTimeout(aliceSelfOutputSigner,
signDesc, sweepTx)
if err != nil {
t.Fatalf("unable to generate delay commit spend witness :%v")
t.Fatalf("unable to generate delay commit spend witness: %v", err)
}
sweepTx.TxIn[0].Witness = aliceWitnessSpend
vm, err := txscript.NewEngine(delayOutput.PkScript,
@@ -378,8 +384,8 @@ func TestHTLCSenderSpendValidation(t *testing.T) {
t.Fatalf("spend test case #%v succeed, spend should be invalid: %v", i, err)
}
debugBuf.WriteString(fmt.Sprintf("Stack: ", vm.GetStack()))
debugBuf.WriteString(fmt.Sprintf("AltStack: ", vm.GetAltStack()))
debugBuf.WriteString(fmt.Sprintf("Stack: %v", vm.GetStack()))
debugBuf.WriteString(fmt.Sprintf("AltStack: %v", vm.GetAltStack()))
}
}
}
@@ -551,8 +557,8 @@ func TestHTLCReceiverSpendValidation(t *testing.T) {
t.Fatalf("spend test case #%v succeed, spend should be invalid: %v", i, err)
}
debugBuf.WriteString(fmt.Sprintf("Stack: ", vm.GetStack()))
debugBuf.WriteString(fmt.Sprintf("AltStack: ", vm.GetAltStack()))
debugBuf.WriteString(fmt.Sprintf("Stack: %v", vm.GetStack()))
debugBuf.WriteString(fmt.Sprintf("AltStack: %v", vm.GetAltStack()))
}
}
}