multi: comprehensive typo fixes across all packages

This commit is contained in:
practicalswift authored and Olaoluwa Osuntokun committed 2018-02-06 19:11:11 -08:00
1 parent 72a5bc8648
commit a93736d21e
103 files changed
+435 -435

No files matched your search

+6 -6
View File
@@ -265,7 +265,7 @@ type ChannelCommitment struct {
Htlcs []HTLC
// TODO(roasbeef): pending commit pointer?
// * lets just walk thru
// * lets just walk through
}
// OpenChannel encapsulates the persistent and dynamic state of an open channel
@@ -399,7 +399,7 @@ func (c *OpenChannel) FullSync() error {
return c.Db.Update(c.fullSync)
}
// updateChanBucket is a helper function that returns a writeable bucket that a
// updateChanBucket is a helper function that returns a writable bucket that a
// channel's data resides in given: the public key for the node, the outpoint,
// and the chainhash that the channel resides on.
func updateChanBucket(tx *bolt.Tx, nodeKey *btcec.PublicKey,
@@ -474,7 +474,7 @@ func readChanBucket(tx *bolt.Tx, nodeKey *btcec.PublicKey,
}
// With the bucket for the node fetched, we can now go down another
// level, for this channel iteslf.
// level, for this channel itself.
var chanPointBuf bytes.Buffer
chanPointBuf.Grow(outPointSize)
if err := writeOutpoint(&chanPointBuf, outPoint); err != nil {
@@ -924,7 +924,7 @@ func (c *OpenChannel) AppendRemoteCommitChain(diff *CommitDiff) error {
defer c.Unlock()
return c.Db.Update(func(tx *bolt.Tx) error {
// First, we'll grab the writeable bucket where this channel's
// First, we'll grab the writable bucket where this channel's
// data resides.
chanBucket, err := updateChanBucket(tx, c.IdentityPub,
&c.FundingOutpoint, c.ChainHash)
@@ -1099,7 +1099,7 @@ func (c *OpenChannel) RevocationLogTail() (*ChannelCommitment, error) {
c.RLock()
defer c.RUnlock()
// If we haven't created any state updates yet, then we'll exit erly as
// If we haven't created any state updates yet, then we'll exit early as
// there's nothing to be found on disk in the revocation bucket.
if c.RemoteCommitment.CommitHeight == 0 {
return nil, nil
@@ -1121,7 +1121,7 @@ func (c *OpenChannel) RevocationLogTail() (*ChannelCommitment, error) {
// Once we have the bucket that stores the revocation log from
// this channel, we'll jump to the _last_ key in bucket. As we
// store the update number on disk in a big-endian format,
// this'll retrieve the latest entry.
// this will retrieve the latest entry.
cursor := logBucket.Cursor()
_, tailLogEntry := cursor.Last()
logEntryReader := bytes.NewReader(tailLogEntry)
+6 -6
View File
@@ -490,7 +490,7 @@ func TestChannelStateTransition(t *testing.T) {
t.Fatalf("unable to append to revocation log: %v", err)
}
// At this point, the remote commit chain shuold be nil, and the posted
// At this point, the remote commit chain should be nil, and the posted
// remote commitment should match the one we added as a diff above.
if _, err := channel.RemoteCommitChainTip(); err != ErrNoPendingCommit {
t.Fatalf("expected ErrNoPendingCommit, instead got %v", err)
@@ -591,7 +591,7 @@ func TestChannelStateTransition(t *testing.T) {
// revocation log has been deleted.
_, err = updatedChannel[0].FindPreviousState(oldRemoteCommit.CommitHeight)
if err == nil {
t.Fatal("revocation log search should've failed")
t.Fatal("revocation log search should have failed")
}
}
@@ -600,7 +600,7 @@ func TestFetchPendingChannels(t *testing.T) {
cdb, cleanUp, err := makeTestDB()
if err != nil {
t.Fatalf("uanble to make test database: %v", err)
t.Fatalf("unable to make test database: %v", err)
}
defer cleanUp()
@@ -630,7 +630,7 @@ func TestFetchPendingChannels(t *testing.T) {
"got %v", 1, len(pendingChannels))
}
// The broadcast height of the pending channel should've been set
// The broadcast height of the pending channel should have been set
// properly.
if pendingChannels[0].FundingBroadcastHeight != broadcastHeight {
t.Fatalf("broadcast height mismatch: expected %v, got %v",
@@ -736,7 +736,7 @@ func TestFetchClosedChannels(t *testing.T) {
// channels only, or not.
pendingClosed, err := cdb.FetchClosedChannels(true)
if err != nil {
t.Fatalf("failed fetcing closed channels: %v", err)
t.Fatalf("failed fetching closed channels: %v", err)
}
if len(pendingClosed) != 1 {
t.Fatalf("incorrect number of pending closed channels: expecting %v,"+
@@ -769,7 +769,7 @@ func TestFetchClosedChannels(t *testing.T) {
// be retrieved when fetching all the closed channels.
closed, err = cdb.FetchClosedChannels(false)
if err != nil {
t.Fatalf("failed fetcing closed channels: %v", err)
t.Fatalf("failed fetching closed channels: %v", err)
}
if len(closed) != 1 {
t.Fatalf("incorrect number of closed channels: expecting %v, "+
+1 -1
View File
@@ -28,7 +28,7 @@ func TestOpenWithCreate(t *testing.T) {
t.Fatalf("unable to close channeldb: %v", err)
}
// The path should have been succesfully created.
// The path should have been successfully created.
if !fileExists(dbPath) {
t.Fatalf("channeldb failed to create data directory")
}
+5 -5
View File
@@ -180,7 +180,7 @@ func (c *ChannelGraph) ForEachChannel(cb func(*ChannelEdgeInfo, *ChannelEdgePoli
// The targeted edge may have not been advertised
// within the network, so we ensure it's non-nil before
// deferencing its attributes.
// dereferencing its attributes.
if edge1 != nil {
edge1.db = c.db
if edge1.Node != nil {
@@ -199,7 +199,7 @@ func (c *ChannelGraph) ForEachChannel(cb func(*ChannelEdgeInfo, *ChannelEdgePoli
// The targeted edge may have not been advertised
// within the network, so we ensure it's non-nil before
// deferencing its attributes.
// dereferencing its attributes.
if edge2 != nil {
edge2.db = c.db
if edge2.Node != nil {
@@ -499,7 +499,7 @@ func (c *ChannelGraph) HasChannelEdge(chanID uint64) (time.Time, time.Time, bool
// If the channel has been found in the graph, then retrieve
// the edges itself so we can return the last updated
// timestmaps.
// timestamps.
nodes := tx.Bucket(nodeBucket)
if nodes == nil {
return ErrGraphNodeNotFound
@@ -595,7 +595,7 @@ func (c *ChannelGraph) PruneGraph(spentOutputs []*wire.OutPoint,
return err
}
// For each of the outpoints that've been spent within the
// For each of the outpoints that have been spent within the
// block, we attempt to delete them from the graph as if that
// outpoint was a channel, then it has now been closed.
for _, chanPoint := range spentOutputs {
@@ -1271,7 +1271,7 @@ type ChannelEdgeInfo struct {
// ChannelAuthProof is the authentication proof (the signature portion) for a
// channel. Using the four signatures contained in the struct, and some
// axillary knowledge (the funding script, node identities, and outpoint) nodes
// auxillary knowledge (the funding script, node identities, and outpoint) nodes
// on the network are able to validate the authenticity and existence of a
// channel. Each of these signatures signs the following digest: chanID ||
// nodeID1 || nodeID2 || bitcoinKey1|| bitcoinKey2 || 2-byte-feature-len ||
+12 -12
View File
@@ -120,7 +120,7 @@ func TestNodeInsertionAndDeletion(t *testing.T) {
}
// Finally, attempt to fetch the node again. This should fail as the
// node should've been deleted from the database.
// node should have been deleted from the database.
_, err = graph.FetchLightningNode(testPub)
if err != ErrGraphNodeNotFound {
t.Fatalf("fetch after delete should fail!")
@@ -185,7 +185,7 @@ func TestPartialNode(t *testing.T) {
}
// Finally, attempt to fetch the node again. This should fail as the
// node should've been deleted from the database.
// node should have been deleted from the database.
_, err = graph.FetchLightningNode(testPub)
if err != ErrGraphNodeNotFound {
t.Fatalf("fetch after delete should fail!")
@@ -355,9 +355,9 @@ func TestEdgeInsertionDeletion(t *testing.T) {
}
}
// TestDisconnecteBlockAtHeight checks that the pruned state of the channel
// TestDisconnectBlockAtHeight checks that the pruned state of the channel
// database is what we expect after calling DisconnectBlockAtHeight.
func TestDisconnecteBlockAtHeight(t *testing.T) {
func TestDisconnectBlockAtHeight(t *testing.T) {
t.Parallel()
db, cleanUp, err := makeTestDB()
@@ -927,7 +927,7 @@ func assertPruneTip(t *testing.T, graph *ChannelGraph, blockHash *chainhash.Hash
}
}
func asserNumChans(t *testing.T, graph *ChannelGraph, n int) {
func assertNumChans(t *testing.T, graph *ChannelGraph, n int) {
numChans := 0
if err := graph.ForEachChannel(func(*ChannelEdgeInfo, *ChannelEdgePolicy,
*ChannelEdgePolicy) error {
@@ -948,7 +948,7 @@ func asserNumChans(t *testing.T, graph *ChannelGraph, n int) {
func assertChanViewEqual(t *testing.T, a []wire.OutPoint, b []*wire.OutPoint) {
if len(a) != len(b) {
_, _, line, _ := runtime.Caller(1)
t.Fatalf("line %v: chan views dont match", line)
t.Fatalf("line %v: chan views don't match", line)
}
chanViewSet := make(map[wire.OutPoint]struct{})
@@ -1080,7 +1080,7 @@ func TestGraphPruning(t *testing.T) {
// Count up the number of channels known within the graph, only 2
// should be remaining.
asserNumChans(t, graph, 2)
assertNumChans(t, graph, 2)
// Those channels should also be missing from the channel view.
channelView, err = graph.ChannelView()
@@ -1104,14 +1104,14 @@ func TestGraphPruning(t *testing.T) {
t.Fatalf("unable to prune graph: %v", err)
}
// No channels should've been detected as pruned.
// No channels should have been detected as pruned.
if len(prunedChans) != 0 {
t.Fatalf("channels were pruned but shouldn't have been")
}
// Once again, the prune tip should've been updated.
// Once again, the prune tip should have been updated.
assertPruneTip(t, graph, &blockHash, blockHeight)
asserNumChans(t, graph, 2)
assertNumChans(t, graph, 2)
// Finally, create a block that prunes the remainder of the channels
// from the graph.
@@ -1123,7 +1123,7 @@ func TestGraphPruning(t *testing.T) {
t.Fatalf("unable to prune graph: %v", err)
}
// The remainder of the channels should've been pruned from the graph.
// The remainder of the channels should have been pruned from the graph.
if len(prunedChans) != 2 {
t.Fatalf("incorrect number of channels pruned: expected %v, got %v",
2, len(prunedChans))
@@ -1132,7 +1132,7 @@ func TestGraphPruning(t *testing.T) {
// The prune tip should be updated, and no channels should be found
// within the current graph.
assertPruneTip(t, graph, &blockHash, blockHeight)
asserNumChans(t, graph, 0)
assertNumChans(t, graph, 0)
// Finally, the channel view at this point in the graph should now be
// completely empty.
+5 -5
View File
@@ -27,7 +27,7 @@ func randInvoice(value lnwire.MilliSatoshi) (*Invoice, error) {
},
}
i.Memo = []byte("memo")
i.Receipt = []byte("recipt")
i.Receipt = []byte("receipt")
// Create a random byte slice of MaxPaymentRequestSize bytes to be used
// as a dummy paymentrequest, and determine if it should be set based
@@ -62,12 +62,12 @@ func TestInvoiceWorkflow(t *testing.T) {
CreationDate: time.Unix(time.Now().Unix(), 0),
}
fakeInvoice.Memo = []byte("memo")
fakeInvoice.Receipt = []byte("recipt")
fakeInvoice.Receipt = []byte("receipt")
fakeInvoice.PaymentRequest = []byte("")
copy(fakeInvoice.Terms.PaymentPreimage[:], rev[:])
fakeInvoice.Terms.Value = lnwire.NewMSatFromSatoshis(10000)
// Add the invoice to the database, this should suceed as there aren't
// Add the invoice to the database, this should succeed as there aren't
// any existing invoices within the database with the same payment
// hash.
if err := db.AddInvoice(fakeInvoice); err != nil {
@@ -144,12 +144,12 @@ func TestInvoiceWorkflow(t *testing.T) {
}
// The retrieve list of invoices should be identical as since we're
// using big endian, the invoices should be retrieved in asecending
// using big endian, the invoices should be retrieved in ascending
// order (and the primary key should be incremented with each
// insertion).
for i := 0; i < len(invoices)-1; i++ {
if !reflect.DeepEqual(invoices[i], dbInvoices[i]) {
t.Fatalf("retrived invoices don't match %v vs %v",
t.Fatalf("retrieved invoices don't match %v vs %v",
spew.Sdump(invoices[i]),
spew.Sdump(dbInvoices[i]))
}
+2 -2
View File
@@ -61,7 +61,7 @@ type ContractTerm struct {
// extended.
PaymentPreimage [32]byte
// Value is the expected amount of milli-satoshis to be payed to an
// Value is the expected amount of milli-satoshis to be paid to an
// HTLC which can be satisfied by the above preimage.
Value lnwire.MilliSatoshi
@@ -301,7 +301,7 @@ func putInvoice(invoices *bolt.Bucket, invoiceIndex *bolt.Bucket,
return err
}
// Add the payment hash to the invoice index. This'll let us quickly
// Add the payment hash to the invoice index. This will let us quickly
// identify if we can settle an incoming payment, and also to possibly
// allow a single invoice to have multiple payment installations.
paymentHash := sha256.Sum256(i.Terms.PaymentPreimage[:])
+7 -7
View File
@@ -192,7 +192,7 @@ func TestMigrationWithPanic(t *testing.T) {
})
}
// Create migration function which changes the initialy created data and
// Create migration function which changes the initially created data and
// throw the panic, in this case we pretending that something goes.
migrationWithPanic := func(tx *bolt.Tx) error {
bucket, err := tx.CreateBucketIfNotExists(bucketPrefix)
@@ -212,7 +212,7 @@ func TestMigrationWithPanic(t *testing.T) {
}
if meta.DbVersionNumber != 0 {
t.Fatal("migration paniced but version is changed")
t.Fatal("migration panicked but version is changed")
}
err = d.Update(func(tx *bolt.Tx) error {
@@ -261,8 +261,8 @@ func TestMigrationWithFatal(t *testing.T) {
})
}
// Create migration function which changes the initialy created data and
// return the error, in this case we pretending that somthing goes
// Create migration function which changes the initially created data and
// return the error, in this case we pretending that something goes
// wrong.
migrationWithFatal := func(tx *bolt.Tx) error {
bucket, err := tx.CreateBucketIfNotExists(bucketPrefix)
@@ -332,7 +332,7 @@ func TestMigrationWithoutErrors(t *testing.T) {
})
}
// Create migration function which changes the initialy created data.
// Create migration function which changes the initially created data.
migrationWithoutErrors := func(tx *bolt.Tx) error {
bucket, err := tx.CreateBucketIfNotExists(bucketPrefix)
if err != nil {
@@ -352,7 +352,7 @@ func TestMigrationWithoutErrors(t *testing.T) {
if meta.DbVersionNumber != 1 {
t.Fatal("version number isn't changed after " +
"succesfully aplied migration")
"successfully applied migration")
}
err = d.Update(func(tx *bolt.Tx) error {
@@ -363,7 +363,7 @@ func TestMigrationWithoutErrors(t *testing.T) {
value := bucket.Get(keyPrefix)
if !bytes.Equal(value, afterMigration) {
return errors.New("migration wasn't applyied " +
return errors.New("migration wasn't applied " +
"properly")
}
+1 -1
View File
@@ -23,7 +23,7 @@ var (
// channel open with. Information such as the Bitcoin network the node
// advertised, and its identity public key are also stored. Additionally, this
// struct and the bucket its stored within have store data similar to that of
// Bitcion's addrmanager. The TCP address information stored within the struct
// Bitcoin's addrmanager. The TCP address information stored within the struct
// can be used to establish persistent connections will all channel
// counterparties on daemon startup.
//
+4 -4
View File
@@ -15,7 +15,7 @@ func TestLinkNodeEncodeDecode(t *testing.T) {
cdb, cleanUp, err := makeTestDB()
if err != nil {
t.Fatalf("uanble to make test database: %v", err)
t.Fatalf("unable to make test database: %v", err)
}
defer cleanUp()
@@ -72,7 +72,7 @@ func TestLinkNodeEncodeDecode(t *testing.T) {
}
}
// Next, we'll excercise the methods to append additionall IP
// Next, we'll exercise the methods to append additional IP
// addresses, and also to update the last seen time.
if err := node1.UpdateLastSeen(time.Now()); err != nil {
t.Fatalf("unable to update last seen: %v", err)
@@ -81,7 +81,7 @@ func TestLinkNodeEncodeDecode(t *testing.T) {
t.Fatalf("unable to update addr: %v", err)
}
// Fetch the same node from the databse according to its public key.
// Fetch the same node from the database according to its public key.
node1DB, err := cdb.FetchLinkNode(pub1)
if err != nil {
t.Fatalf("unable to find node: %v", err)
@@ -94,7 +94,7 @@ func TestLinkNodeEncodeDecode(t *testing.T) {
node1.LastSeen.Unix(), node1DB.LastSeen.Unix())
}
if len(node1DB.Addresses) != 2 {
t.Fatalf("wrong length for node1 addrsses: expected %v, got %v",
t.Fatalf("wrong length for node1 addresses: expected %v, got %v",
2, len(node1DB.Addresses))
}
if node1DB.Addresses[0].String() != addr1.String() {