Browse Source

misc: fix error formatting in multiple files

master
Andras Banki-Horvath 4 years ago
parent
commit
556e3525ea
  1. 2
      autopilot/agent.go
  2. 2
      autopilot/combinedattach.go
  3. 4
      breacharbiter.go
  4. 6
      brontide/noise.go
  5. 2
      chainntnfs/txnotifier.go
  6. 2
      chainregistry.go
  7. 4
      channeldb/graph.go
  8. 2
      config.go
  9. 8
      fundingmanager.go
  10. 2
      fundingmanager_test.go
  11. 4
      htlcswitch/decayedlog.go
  12. 2
      htlcswitch/link.go
  13. 6
      htlcswitch/switch.go
  14. 2
      input/script_utils.go
  15. 8
      input/test_utils.go
  16. 54
      lnd.go
  17. 26
      lntest/harness.go
  18. 2
      lntest/node.go
  19. 4
      lnwallet/channel.go
  20. 10
      lnwallet/errors.go
  21. 2
      lnwallet/interface.go
  22. 2
      lnwallet/interface_test.go
  23. 6
      lnwire/lnwire.go
  24. 6
      peer.go
  25. 6
      pilot.go
  26. 2
      routing/notifications.go
  27. 2
      routing/router.go
  28. 4
      server.go

2
autopilot/agent.go

@ -648,7 +648,7 @@ func (a *Agent) openChans(availableFunds btcutil.Amount, numChans uint32,
// to open channels to.
scores, err = chooseN(numChans, scores)
if err != nil {
return fmt.Errorf("Unable to make weighted choice: %v",
return fmt.Errorf("unable to make weighted choice: %v",
err)
}

2
autopilot/combinedattach.go

@ -130,7 +130,7 @@ func (c *WeightedCombAttachment) NodeScores(g ChannelGraph, chans []Channel,
// Sanity check the new score.
case score.Score < 0 || score.Score > 1.0:
return nil, fmt.Errorf("Invalid node score from "+
return nil, fmt.Errorf("invalid node score from "+
"combination: %v", score.Score)
}

4
breacharbiter.go

@ -1358,8 +1358,8 @@ func (rs *retributionStore) Remove(chanPoint *wire.OutPoint) error {
// to remove a finalized retribution state that is not already
// stored in the db.
if retBucket == nil {
return errors.New("Unable to remove retribution " +
"because the retribution bucket doesn't exist.")
return errors.New("unable to remove retribution " +
"because the retribution bucket doesn't exist")
}
// Serialize the channel point we are intending to remove.

6
brontide/noise.go

@ -492,7 +492,7 @@ func (b *Machine) RecvActOne(actOne [ActOneSize]byte) error {
// If the handshake version is unknown, then the handshake fails
// immediately.
if actOne[0] != HandshakeVersion {
return fmt.Errorf("Act One: invalid handshake version: %v, "+
return fmt.Errorf("act one: invalid handshake version: %v, "+
"only %v is valid, msg=%x", actOne[0], HandshakeVersion,
actOne[:])
}
@ -564,7 +564,7 @@ func (b *Machine) RecvActTwo(actTwo [ActTwoSize]byte) error {
// If the handshake version is unknown, then the handshake fails
// immediately.
if actTwo[0] != HandshakeVersion {
return fmt.Errorf("Act Two: invalid handshake version: %v, "+
return fmt.Errorf("act two: invalid handshake version: %v, "+
"only %v is valid, msg=%x", actTwo[0], HandshakeVersion,
actTwo[:])
}
@ -630,7 +630,7 @@ func (b *Machine) RecvActThree(actThree [ActThreeSize]byte) error {
// If the handshake version is unknown, then the handshake fails
// immediately.
if actThree[0] != HandshakeVersion {
return fmt.Errorf("Act Three: invalid handshake version: %v, "+
return fmt.Errorf("act three: invalid handshake version: %v, "+
"only %v is valid, msg=%x", actThree[0], HandshakeVersion,
actThree[:])
}

2
chainntnfs/txnotifier.go

@ -1690,7 +1690,7 @@ func (n *TxNotifier) DisconnectTip(blockHeight uint32) error {
defer n.Unlock()
if blockHeight != n.currentHeight {
return fmt.Errorf("Received blocks out of order: "+
return fmt.Errorf("received blocks out of order: "+
"current height=%d, disconnected height=%d",
n.currentHeight, blockHeight)
}

2
chainregistry.go

@ -201,7 +201,7 @@ func newChainControlFromConfig(cfg *config, chanDB *channeldb.DB,
defaultLitecoinStaticFeePerKW, 0,
)
default:
return nil, fmt.Errorf("Default routing policy for chain %v is "+
return nil, fmt.Errorf("default routing policy for chain %v is "+
"unknown", registeredChains.PrimaryChain())
}

4
channeldb/graph.go

@ -3086,7 +3086,7 @@ func (c *ChannelGraph) IsPublicNode(pubKey [33]byte) (bool, error) {
// genMultiSigP2WSH generates the p2wsh'd multisig script for 2 of 2 pubkeys.
func genMultiSigP2WSH(aPub, bPub []byte) ([]byte, error) {
if len(aPub) != 33 || len(bPub) != 33 {
return nil, fmt.Errorf("Pubkey size error. Compressed " +
return nil, fmt.Errorf("pubkey size error. Compressed " +
"pubkeys only")
}
@ -3833,7 +3833,7 @@ func putChanEdgePolicyUnknown(edges kvdb.RwBucket, channelID uint64,
byteOrder.PutUint64(edgeKey[33:], channelID)
if edges.Get(edgeKey[:]) != nil {
return fmt.Errorf("Cannot write unknown policy for channel %v "+
return fmt.Errorf("cannot write unknown policy for channel %v "+
" when there is already a policy present", channelID)
}

2
config.go

@ -1150,7 +1150,7 @@ func loadConfig() (*config, error) {
// the wallet.
_, err = parseHexColor(cfg.Color)
if err != nil {
return nil, fmt.Errorf("Unable to parse node color: %v", err)
return nil, fmt.Errorf("unable to parse node color: %v", err)
}
// Warn about missing config file only after all other configuration is

8
fundingmanager.go

@ -1929,7 +1929,7 @@ func (f *fundingManager) handleFundingSigned(fmsg *fundingSignedMsg) {
delete(f.signedReservations, fmsg.msg.ChanID)
f.resMtx.Unlock()
if !ok {
err := fmt.Errorf("Unable to find signed reservation for "+
err := fmt.Errorf("unable to find signed reservation for "+
"chan_id=%x", fmsg.msg.ChanID)
fndgLog.Warnf(err.Error())
f.failFundingFlow(fmsg.peer, fmsg.msg.ChanID, err)
@ -2562,7 +2562,7 @@ func (f *fundingManager) annAfterSixConfs(completeChan *channeldb.OpenChannel,
completeChan.FundingBroadcastHeight,
)
if err != nil {
return fmt.Errorf("Unable to register for "+
return fmt.Errorf("unable to register for "+
"confirmation of ChannelPoint(%v): %v",
completeChan.FundingOutpoint, err)
}
@ -3217,7 +3217,7 @@ func (f *fundingManager) handleInitFundingMsg(msg *initFundingMsg) {
UpfrontShutdownScript: shutdown,
}
if err := msg.peer.SendMessage(true, &fundingOpen); err != nil {
e := fmt.Errorf("Unable to send funding request message: %v",
e := fmt.Errorf("unable to send funding request message: %v",
err)
fndgLog.Errorf(e.Error())
@ -3501,7 +3501,7 @@ func (f *fundingManager) deleteChannelOpeningState(chanPoint *wire.OutPoint) err
return kvdb.Update(f.cfg.Wallet.Cfg.Database, func(tx kvdb.RwTx) error {
bucket := tx.ReadWriteBucket(channelOpeningStateBucket)
if bucket == nil {
return fmt.Errorf("Bucket not found")
return fmt.Errorf("bucket not found")
}
var outpointBytes bytes.Buffer

2
fundingmanager_test.go

@ -2839,7 +2839,7 @@ func TestFundingManagerRejectPush(t *testing.T) {
// Assert Bob responded with an ErrNonZeroPushAmount error.
err := assertFundingMsgSent(t, bob.msgChan, "Error").(*lnwire.Error)
if !strings.Contains(err.Error(), "Non-zero push amounts are disabled") {
if !strings.Contains(err.Error(), "non-zero push amounts are disabled") {
t.Fatalf("expected ErrNonZeroPushAmount error, got \"%v\"",
err.Error())
}

4
htlcswitch/decayedlog.go

@ -93,7 +93,7 @@ func (d *DecayedLog) Start() error {
kvdb.BoltBackendName, d.dbPath, true,
)
if err != nil {
return fmt.Errorf("Could not open boltdb: %v", err)
return fmt.Errorf("could not open boltdb: %v", err)
}
// Initialize the primary buckets used by the decayed log.
@ -105,7 +105,7 @@ func (d *DecayedLog) Start() error {
if d.notifier != nil {
epochClient, err := d.notifier.RegisterBlockEpochNtfn(nil)
if err != nil {
return fmt.Errorf("Unable to register for epoch "+
return fmt.Errorf("unable to register for epoch "+
"notifications: %v", err)
}

2
htlcswitch/link.go

@ -634,7 +634,7 @@ func (l *channelLink) syncChanStates() error {
}
if err := l.cfg.Peer.SendMessage(true, localChanSyncMsg); err != nil {
return fmt.Errorf("Unable to send chan sync message for "+
return fmt.Errorf("unable to send chan sync message for "+
"ChannelPoint(%v): %v", l.channel.ChannelPoint(), err)
}

6
htlcswitch/switch.go

@ -421,7 +421,7 @@ func (s *Switch) GetPaymentResult(paymentID uint64, paymentHash lntypes.Hash,
deobfuscator, n, paymentID, paymentHash,
)
if err != nil {
e := fmt.Errorf("Unable to extract result: %v", err)
e := fmt.Errorf("unable to extract result: %v", err)
log.Error(e)
resultChan <- &PaymentResult{
Error: e,
@ -770,7 +770,7 @@ func (s *Switch) routeAsync(packet *htlcPacket, errChan chan error,
case <-linkQuit:
return ErrLinkShuttingDown
case <-s.quit:
return errors.New("Htlc Switch was stopped")
return errors.New("htlc switch was stopped")
}
}
@ -962,7 +962,7 @@ func (s *Switch) extractResult(deobfuscator ErrorDecrypter, n *networkResult,
}, nil
default:
return nil, fmt.Errorf("Received unknown response type: %T",
return nil, fmt.Errorf("received unknown response type: %T",
htlc)
}
}

2
input/script_utils.go

@ -49,7 +49,7 @@ func WitnessScriptHash(witnessScript []byte) ([]byte, error) {
// pubkeys.
func GenMultiSigScript(aPub, bPub []byte) ([]byte, error) {
if len(aPub) != 33 || len(bPub) != 33 {
return nil, fmt.Errorf("Pubkey size error. Compressed pubkeys only")
return nil, fmt.Errorf("pubkey size error: compressed pubkeys only")
}
// Swap to sort pubkeys if needed. Keys are sorted in lexicographical

8
input/test_utils.go

@ -64,7 +64,7 @@ func (m *MockSigner) SignOutputRaw(tx *wire.MsgTx,
hash160 := btcutil.Hash160(pubkey.SerializeCompressed())
privKey := m.findKey(hash160, signDesc.SingleTweak, signDesc.DoubleTweak)
if privKey == nil {
return nil, fmt.Errorf("Mock signer does not have key")
return nil, fmt.Errorf("mock signer does not have key")
}
sig, err := txscript.RawTxInWitnessSignature(tx, signDesc.SigHashes,
@ -93,7 +93,7 @@ func (m *MockSigner) ComputeInputScript(tx *wire.MsgTx, signDesc *SignDescriptor
privKey := m.findKey(addresses[0].ScriptAddress(), signDesc.SingleTweak,
signDesc.DoubleTweak)
if privKey == nil {
return nil, fmt.Errorf("Mock signer does not have key for "+
return nil, fmt.Errorf("mock signer does not have key for "+
"address %v", addresses[0])
}
@ -111,7 +111,7 @@ func (m *MockSigner) ComputeInputScript(tx *wire.MsgTx, signDesc *SignDescriptor
privKey := m.findKey(addresses[0].ScriptAddress(), signDesc.SingleTweak,
signDesc.DoubleTweak)
if privKey == nil {
return nil, fmt.Errorf("Mock signer does not have key for "+
return nil, fmt.Errorf("mock signer does not have key for "+
"address %v", addresses[0])
}
@ -125,7 +125,7 @@ func (m *MockSigner) ComputeInputScript(tx *wire.MsgTx, signDesc *SignDescriptor
return &Script{Witness: witnessScript}, nil
default:
return nil, fmt.Errorf("Unexpected script type: %v", scriptType)
return nil, fmt.Errorf("unexpected script type: %v", scriptType)
}
}

54
lnd.go

@ -209,7 +209,7 @@ func Main(lisCfg ListenerCfg) error {
if cfg.CPUProfile != "" {
f, err := os.Create(cfg.CPUProfile)
if err != nil {
err := fmt.Errorf("Unable to create CPU profile: %v",
err := fmt.Errorf("unable to create CPU profile: %v",
err)
ltndLog.Error(err)
return err
@ -237,7 +237,7 @@ func Main(lisCfg ListenerCfg) error {
channeldb.OptionSetSyncFreelist(cfg.SyncFreelist),
)
if err != nil {
err := fmt.Errorf("Unable to open channeldb: %v", err)
err := fmt.Errorf("unable to open channeldb: %v", err)
ltndLog.Error(err)
return err
}
@ -256,7 +256,7 @@ func Main(lisCfg ListenerCfg) error {
cfg.TLSExtraDomains, cfg.RPCListeners,
)
if err != nil {
err := fmt.Errorf("Unable to load TLS credentials: %v", err)
err := fmt.Errorf("unable to load TLS credentials: %v", err)
ltndLog.Error(err)
return err
}
@ -289,7 +289,7 @@ func Main(lisCfg ListenerCfg) error {
mainChain.ChainDir,
)
if err != nil {
err := fmt.Errorf("Unable to initialize neutrino "+
err := fmt.Errorf("unable to initialize neutrino "+
"backend: %v", err)
ltndLog.Error(err)
return err
@ -364,7 +364,7 @@ func Main(lisCfg ListenerCfg) error {
restProxyDest, tlsCfg, walletUnlockerListeners,
)
if err != nil {
err := fmt.Errorf("Unable to set up wallet password "+
err := fmt.Errorf("unable to set up wallet password "+
"listeners: %v", err)
ltndLog.Error(err)
return err
@ -388,7 +388,7 @@ func Main(lisCfg ListenerCfg) error {
networkDir, macaroons.IPLockChecker,
)
if err != nil {
err := fmt.Errorf("Unable to set up macaroon "+
err := fmt.Errorf("unable to set up macaroon "+
"authentication: %v", err)
ltndLog.Error(err)
return err
@ -398,7 +398,7 @@ func Main(lisCfg ListenerCfg) error {
// Try to unlock the macaroon store with the private password.
err = macaroonService.CreateUnlock(&privateWalletPw)
if err != nil {
err := fmt.Errorf("Unable to unlock macaroons: %v", err)
err := fmt.Errorf("unable to unlock macaroons: %v", err)
ltndLog.Error(err)
return err
}
@ -412,7 +412,7 @@ func Main(lisCfg ListenerCfg) error {
cfg.ReadMacPath, cfg.InvoiceMacPath,
)
if err != nil {
err := fmt.Errorf("Unable to create macaroons "+
err := fmt.Errorf("unable to create macaroons "+
"%v", err)
ltndLog.Error(err)
return err
@ -429,7 +429,7 @@ func Main(lisCfg ListenerCfg) error {
walletInitParams.Wallet, neutrinoCS,
)
if err != nil {
err := fmt.Errorf("Unable to create chain control: %v", err)
err := fmt.Errorf("unable to create chain control: %v", err)
ltndLog.Error(err)
return err
}
@ -448,7 +448,7 @@ func Main(lisCfg ListenerCfg) error {
},
})
if err != nil {
err := fmt.Errorf("Unable to derive node private key: %v", err)
err := fmt.Errorf("unable to derive node private key: %v", err)
ltndLog.Error(err)
return err
}
@ -467,7 +467,7 @@ func Main(lisCfg ListenerCfg) error {
var err error
towerClientDB, err = wtdb.OpenClientDB(graphDir)
if err != nil {
err := fmt.Errorf("Unable to open watchtower client "+
err := fmt.Errorf("unable to open watchtower client "+
"database: %v", err)
ltndLog.Error(err)
return err
@ -508,7 +508,7 @@ func Main(lisCfg ListenerCfg) error {
towerDB, err := wtdb.OpenTowerDB(towerDBDir)
if err != nil {
err := fmt.Errorf("Unable to open watchtower "+
err := fmt.Errorf("unable to open watchtower "+
"database: %v", err)
ltndLog.Error(err)
return err
@ -524,7 +524,7 @@ func Main(lisCfg ListenerCfg) error {
},
)
if err != nil {
err := fmt.Errorf("Unable to derive watchtower "+
err := fmt.Errorf("unable to derive watchtower "+
"private key: %v", err)
ltndLog.Error(err)
return err
@ -561,7 +561,7 @@ func Main(lisCfg ListenerCfg) error {
wtConfig, err := cfg.Watchtower.Apply(wtCfg, lncfg.NormalizeAddresses)
if err != nil {
err := fmt.Errorf("Unable to configure watchtower: %v",
err := fmt.Errorf("unable to configure watchtower: %v",
err)
ltndLog.Error(err)
return err
@ -569,7 +569,7 @@ func Main(lisCfg ListenerCfg) error {
tower, err = watchtower.New(wtConfig)
if err != nil {
err := fmt.Errorf("Unable to create watchtower: %v", err)
err := fmt.Errorf("unable to create watchtower: %v", err)
ltndLog.Error(err)
return err
}
@ -586,7 +586,7 @@ func Main(lisCfg ListenerCfg) error {
torController,
)
if err != nil {
err := fmt.Errorf("Unable to create server: %v", err)
err := fmt.Errorf("unable to create server: %v", err)
ltndLog.Error(err)
return err
}
@ -596,19 +596,19 @@ func Main(lisCfg ListenerCfg) error {
// it at will.
atplCfg, err := initAutoPilot(server, cfg.Autopilot, mainChain)
if err != nil {
err := fmt.Errorf("Unable to initialize autopilot: %v", err)
err := fmt.Errorf("unable to initialize autopilot: %v", err)
ltndLog.Error(err)
return err
}
atplManager, err := autopilot.NewManager(atplCfg)
if err != nil {
err := fmt.Errorf("Unable to create autopilot manager: %v", err)
err := fmt.Errorf("unable to create autopilot manager: %v", err)
ltndLog.Error(err)
return err
}
if err := atplManager.Start(); err != nil {
err := fmt.Errorf("Unable to start autopilot manager: %v", err)
err := fmt.Errorf("unable to start autopilot manager: %v", err)
ltndLog.Error(err)
return err
}
@ -636,12 +636,12 @@ func Main(lisCfg ListenerCfg) error {
tower, tlsCfg, rpcListeners, chainedAcceptor,
)
if err != nil {
err := fmt.Errorf("Unable to create RPC server: %v", err)
err := fmt.Errorf("unable to create RPC server: %v", err)
ltndLog.Error(err)
return err
}
if err := rpcServer.Start(); err != nil {
err := fmt.Errorf("Unable to start RPC server: %v", err)
err := fmt.Errorf("unable to start RPC server: %v", err)
ltndLog.Error(err)
return err
}
@ -656,7 +656,7 @@ func Main(lisCfg ListenerCfg) error {
_, bestHeight, err := activeChainControl.chainIO.GetBestBlock()
if err != nil {
err := fmt.Errorf("Unable to determine chain tip: %v",
err := fmt.Errorf("unable to determine chain tip: %v",
err)
ltndLog.Error(err)
return err
@ -672,7 +672,7 @@ func Main(lisCfg ListenerCfg) error {
synced, _, err := activeChainControl.wallet.IsSynced()
if err != nil {
err := fmt.Errorf("Unable to determine if "+
err := fmt.Errorf("unable to determine if "+
"wallet is synced: %v", err)
ltndLog.Error(err)
return err
@ -687,7 +687,7 @@ func Main(lisCfg ListenerCfg) error {
_, bestHeight, err = activeChainControl.chainIO.GetBestBlock()
if err != nil {
err := fmt.Errorf("Unable to determine chain tip: %v",
err := fmt.Errorf("unable to determine chain tip: %v",
err)
ltndLog.Error(err)
return err
@ -700,7 +700,7 @@ func Main(lisCfg ListenerCfg) error {
// With all the relevant chains initialized, we can finally start the
// server itself.
if err := server.Start(); err != nil {
err := fmt.Errorf("Unable to start server: %v", err)
err := fmt.Errorf("unable to start server: %v", err)
ltndLog.Error(err)
return err
}
@ -711,7 +711,7 @@ func Main(lisCfg ListenerCfg) error {
// stopped together with the autopilot service.
if cfg.Autopilot.Active {
if err := atplManager.StartAgent(); err != nil {
err := fmt.Errorf("Unable to start autopilot agent: %v",
err := fmt.Errorf("unable to start autopilot agent: %v",
err)
ltndLog.Error(err)
return err
@ -720,7 +720,7 @@ func Main(lisCfg ListenerCfg) error {
if cfg.Watchtower.Active {
if err := tower.Start(); err != nil {
err := fmt.Errorf("Unable to start watchtower: %v", err)
err := fmt.Errorf("unable to start watchtower: %v", err)
ltndLog.Error(err)
return err
}

26
lntest/harness.go

@ -685,7 +685,7 @@ func (n *NetworkHarness) SaveProfilesPages() {
for _, node := range n.activeNodes {
if err := saveProfilesPage(node); err != nil {
fmt.Println(err)
fmt.Printf("Error: %v\n", err)
}
}
}
@ -699,16 +699,16 @@ func saveProfilesPage(node *HarnessNode) error {
),
)
if err != nil {
return fmt.Errorf("Failed to get profile page "+
"(node_id=%d, name=%s): %v\n",
return fmt.Errorf("failed to get profile page "+
"(node_id=%d, name=%s): %v",
node.NodeID, node.Cfg.Name, err)
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return fmt.Errorf("Failed to read profile page "+
"(node_id=%d, name=%s): %v\n",
return fmt.Errorf("failed to read profile page "+
"(node_id=%d, name=%s): %v",
node.NodeID, node.Cfg.Name, err)
}
@ -719,16 +719,16 @@ func saveProfilesPage(node *HarnessNode) error {
logFile, err := os.Create(fileName)
if err != nil {
return fmt.Errorf("Failed to create file for profile page "+
"(node_id=%d, name=%s): %v\n",
return fmt.Errorf("failed to create file for profile page "+
"(node_id=%d, name=%s): %v",
node.NodeID, node.Cfg.Name, err)
}
defer logFile.Close()
_, err = logFile.Write(body)
if err != nil {
return fmt.Errorf("Failed to save profile page "+
"(node_id=%d, name=%s): %v\n",
return fmt.Errorf("failed to save profile page "+
"(node_id=%d, name=%s): %v",
node.NodeID, node.Cfg.Name, err)
}
return nil
@ -872,10 +872,10 @@ func (n *NetworkHarness) OpenChannel(ctx context.Context,
// prevents any funding workflows from being kicked off if the chain
// isn't yet synced.
if err := srcNode.WaitForBlockchainSync(ctx); err != nil {
return nil, fmt.Errorf("Unable to sync srcNode chain: %v", err)
return nil, fmt.Errorf("enable to sync srcNode chain: %v", err)
}
if err := destNode.WaitForBlockchainSync(ctx); err != nil {
return nil, fmt.Errorf("Unable to sync destNode chain: %v", err)
return nil, fmt.Errorf("unable to sync destNode chain: %v", err)
}
minConfs := int32(1)
@ -941,10 +941,10 @@ func (n *NetworkHarness) OpenPendingChannel(ctx context.Context,
// Wait until srcNode and destNode have blockchain synced
if err := srcNode.WaitForBlockchainSync(ctx); err != nil {
return nil, fmt.Errorf("Unable to sync srcNode chain: %v", err)
return nil, fmt.Errorf("unable to sync srcNode chain: %v", err)
}
if err := destNode.WaitForBlockchainSync(ctx); err != nil {
return nil, fmt.Errorf("Unable to sync destNode chain: %v", err)
return nil, fmt.Errorf("unable to sync destNode chain: %v", err)
}
openReq := &lnrpc.OpenChannelRequest{

2
lntest/node.go

@ -1122,7 +1122,7 @@ func (hn *HarnessNode) WaitForBlockchainSync(ctx context.Context) error {
case err := <-errChan:
return err
case <-ctx.Done():
return fmt.Errorf("Timeout while waiting for blockchain sync")
return fmt.Errorf("timeout while waiting for blockchain sync")
}
}

4
lnwallet/channel.go

@ -3920,7 +3920,7 @@ func genHtlcSigValidationJobs(localCommitmentView *commitment,
// Make sure there are more signatures left.
if i >= len(htlcSigs) {
return nil, fmt.Errorf("not enough HTLC " +
"signatures.")
"signatures")
}
// With the sighash generated, we'll also store the
@ -3974,7 +3974,7 @@ func genHtlcSigValidationJobs(localCommitmentView *commitment,
// Make sure there are more signatures left.
if i >= len(htlcSigs) {
return nil, fmt.Errorf("not enough HTLC " +
"signatures.")
"signatures")
}
// With the sighash generated, we'll also store the

10
lnwallet/errors.go

@ -34,7 +34,7 @@ func ErrZeroCapacity() ReservationError {
func ErrChainMismatch(knownChain,
unknownChain *chainhash.Hash) ReservationError {
return ReservationError{
fmt.Errorf("Unknown chain=%v. Supported chain=%v",
fmt.Errorf("unknown chain=%v, supported chain=%v",
unknownChain, knownChain),
}
}
@ -44,7 +44,7 @@ func ErrChainMismatch(knownChain,
func ErrFunderBalanceDust(commitFee, funderBalance,
minBalance int64) ReservationError {
return ReservationError{
fmt.Errorf("Funder balance too small (%v) with fee=%v sat, "+
fmt.Errorf("funder balance too small (%v) with fee=%v sat, "+
"minimum=%v sat required", funderBalance,
commitFee, minBalance),
}
@ -73,7 +73,7 @@ func ErrChanReserveTooSmall(reserve, dustLimit btcutil.Amount) ReservationError
func ErrChanReserveTooLarge(reserve,
maxReserve btcutil.Amount) ReservationError {
return ReservationError{
fmt.Errorf("Channel reserve is too large: %v sat, max "+
fmt.Errorf("channel reserve is too large: %v sat, max "+
"is %v sat", int64(reserve), int64(maxReserve)),
}
}
@ -82,7 +82,7 @@ func ErrChanReserveTooLarge(reserve,
// FundingOpen request for a channel with non-zero push amount while
// they have 'rejectpush' enabled.
func ErrNonZeroPushAmount() ReservationError {
return ReservationError{errors.New("Non-zero push amounts are disabled")}
return ReservationError{errors.New("non-zero push amounts are disabled")}
}
// ErrMinHtlcTooLarge returns an error indicating that the MinHTLC value the
@ -90,7 +90,7 @@ func ErrNonZeroPushAmount() ReservationError {
func ErrMinHtlcTooLarge(minHtlc,
maxMinHtlc lnwire.MilliSatoshi) ReservationError {
return ReservationError{
fmt.Errorf("Minimum HTLC value is too large: %v, max is %v",
fmt.Errorf("minimum HTLC value is too large: %v, max is %v",
minHtlc, maxMinHtlc),
}
}

2
lnwallet/interface.go

@ -43,7 +43,7 @@ var (
// ErrDoubleSpend is returned from PublishTransaction in case the
// tx being published is spending an output spent by a conflicting
// transaction.
ErrDoubleSpend = errors.New("Transaction rejected: output already spent")
ErrDoubleSpend = errors.New("transaction rejected: output already spent")
// ErrNotMine is an error denoting that a WalletController instance is
// unable to spend a specified output.

2
lnwallet/interface_test.go

@ -753,7 +753,7 @@ func testReservationInitiatorBalanceBelowDustCancel(miner *rpctest.Harness,
t.Fatalf("initialization should have failed due to " +
"insufficient local amount")
case !strings.Contains(err.Error(), "Funder balance too small"):
case !strings.Contains(err.Error(), "funder balance too small"):
t.Fatalf("incorrect error: %v", err)
}
}

6
lnwire/lnwire.go

@ -419,7 +419,7 @@ func WriteElement(w io.Writer, element interface{}) error {
return err
}
default:
return fmt.Errorf("Unknown type in WriteElement: %T", e)
return fmt.Errorf("unknown type in WriteElement: %T", e)
}
return nil
@ -818,14 +818,14 @@ func ReadElement(r io.Reader, element interface{}) error {
var addrBytes [deliveryAddressMaxSize]byte
if length > deliveryAddressMaxSize {
return fmt.Errorf("Cannot read %d bytes into addrBytes", length)
return fmt.Errorf("cannot read %d bytes into addrBytes", length)
}
if _, err = io.ReadFull(r, addrBytes[:length]); err != nil {
return err
}
*e = addrBytes[:length]
default:
return fmt.Errorf("Unknown type in ReadElement: %T", e)
return fmt.Errorf("unknown type in ReadElement: %T", e)
}
return nil

6
peer.go

@ -1115,7 +1115,7 @@ func (p *peer) readHandler() {
// We'll stop the timer after a new messages is received, and also
// reset it after we process the next message.
idleTimer := time.AfterFunc(idleTimeout, func() {
err := fmt.Errorf("Peer %s no answer for %s -- disconnecting",
err := fmt.Errorf("peer %s no answer for %s -- disconnecting",
p, idleTimeout)
p.Disconnect(err)
})
@ -1657,7 +1657,7 @@ func (p *peer) writeHandler() {
// We'll stop the timer after a new messages is sent, and also reset it
// after we process the next message.
idleTimer := time.AfterFunc(idleTimeout, func() {
err := fmt.Errorf("Peer %s no write for %s -- disconnecting",
err := fmt.Errorf("peer %s no write for %s -- disconnecting",
p, idleTimeout)
p.Disconnect(err)
})
@ -2724,7 +2724,7 @@ func (p *peer) resendChanSyncMsg(cid lnwire.ChannelID) error {
"peer %v", cid, p)
if err := p.SendMessage(true, c.LastChanSyncMsg); err != nil {
return fmt.Errorf("Failed resending channel sync "+
return fmt.Errorf("failed resending channel sync "+
"message to peer %v: %v", p, err)
}

6
pilot.go

@ -39,7 +39,7 @@ func validateAtplCfg(cfg *autoPilotConfig) ([]*autopilot.WeightedHeuristic,
a, ok := autopilot.AvailableHeuristics[name]
if !ok {
// No heuristic matching this config option was found.
return nil, fmt.Errorf("Heuristic %v not available. %v",
return nil, fmt.Errorf("heuristic %v not available. %v",
name, availStr)
}
@ -58,11 +58,11 @@ func validateAtplCfg(cfg *autoPilotConfig) ([]*autopilot.WeightedHeuristic,
// Check found heuristics. We must have at least one to operate.
if len(heuristics) == 0 {
return nil, fmt.Errorf("No active heuristics. %v", availStr)
return nil, fmt.Errorf("no active heuristics: %v", availStr)
}
if sum != 1.0 {
return nil, fmt.Errorf("Heuristic weights must sum to 1.0")
return nil, fmt.Errorf("heuristic weights must sum to 1.0")
}
return heuristics, nil
}

2
routing/notifications.go

@ -386,7 +386,7 @@ func addToTopologyChange(graph *channeldb.ChannelGraph, update *TopologyChange,
return nil
default:
return fmt.Errorf("Unable to add to topology change, "+
return fmt.Errorf("unable to add to topology change, "+
"unknown message type %T", msg)
}
}

2
routing/router.go

@ -2197,7 +2197,7 @@ func (r *ChannelRouter) ForAllOutgoingChannels(cb func(*channeldb.ChannelEdgeInf
e, _ *channeldb.ChannelEdgePolicy) error {
if e == nil {
return fmt.Errorf("Channel from self node has no policy")
return fmt.Errorf("channel from self node has no policy")
}
return cb(c, e)

4
server.go

@ -547,7 +547,7 @@ func newServer(listenAddrs []net.Addr, chanDB *channeldb.DB,
pmp, err := nat.DiscoverPMP(discoveryTimeout)
if err != nil {
err := fmt.Errorf("Unable to discover a "+
err := fmt.Errorf("unable to discover a "+
"NAT-PMP enabled device on the local "+
"network: %v", err)
srvrLog.Error(err)
@ -1995,7 +1995,7 @@ func (s *server) createNewHiddenService() error {
},
)
if err != nil {
return fmt.Errorf("Unable to generate new node "+
return fmt.Errorf("unable to generate new node "+
"announcement: %v", err)
}

Loading…
Cancel
Save