Skip to content

Commit

Permalink
Merge 8377857 into 35c9a12
Browse files Browse the repository at this point in the history
  • Loading branch information
halseth committed Apr 11, 2017
2 parents 35c9a12 + 8377857 commit 4c7aec2
Show file tree
Hide file tree
Showing 39 changed files with 113 additions and 114 deletions.
2 changes: 1 addition & 1 deletion brontide/noise_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ func TestWriteMessageChunking(t *testing.T) {

// Launch a new goroutine to write the large message generated above in
// chunks. We spawn a new goroutine because otherwise, we may block as
// the kernal waits for the buffer to flush.
// the kernel waits for the buffer to flush.
var wg sync.WaitGroup
wg.Add(1)
go func() {
Expand Down
2 changes: 1 addition & 1 deletion channeldb/channel.go
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ type ChannelDelta struct {
// increasing.
UpdateNum uint64

// Htlcs is the set of HTLC's that are pending at this particular
// Htlcs is the set of HTLCs that are pending at this particular
// commitment height.
Htlcs []*HTLC
}
Expand Down
2 changes: 1 addition & 1 deletion discovery/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ func copyPubKey(pub *btcec.PublicKey) *btcec.PublicKey {
}

// SignAnnouncement is a helper function which is used to sign any outgoing
// channel node node announcement messages.
// channel node announcement messages.
func SignAnnouncement(signer *lnwallet.MessageSigner,
msg lnwire.Message) (*btcec.Signature, error) {

Expand Down
2 changes: 1 addition & 1 deletion docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ bitcoins. The schema will be following:
+ --------------- +
(1) You may connect an additinal node "Bob" and make the multihope
(1) You may connect an additinal node "Bob" and make the multihop
payment Alice->Faucet->Bob
(2) "Faucet", "Alice" and "Bob" are the lightning network daemons which
Expand Down
2 changes: 1 addition & 1 deletion docs/code_contribution_guidelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ Functions should _not_ just be layed out as a bare contiguous block of code.
#### 4.5.6. Protobuf Compilation
The `lnd` project uses `protobuf`, and its extension [`gRPC`](www.grpc.io) in
The `lnd` project uses `protobuf`, and its extension [`gRPC`](http://www.grpc.io) in
several areas and as the primary RPC interface. In order to ensure uniformity
of all protos checked, in we require that all contributors pin against the
_exact same_ version of `protoc`. As of the writing of this article, the `lnd`
Expand Down
10 changes: 5 additions & 5 deletions htlcswitch.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ var (

// boundedLinkChan is a simple wrapper around a link's communication channel
// that bounds the total flow into and through the channel. Channels attached
// the link have a value which defines the max number of pending HTLC's present
// the link have a value which defines the max number of pending HTLCs present
// within the commitment transaction. Using this struct we establish a
// synchronization primitive that ensure we don't send additional htlcPackets
// to a link if the max limit has een reached. Once HTLC's are cleared from the
// to a link if the max limit has been reached. Once HTLCs are cleared from the
// commitment transaction, slots are freed up and more can proceed.
type boundedLinkChan struct {
// slots is a buffered channel whose buffer is the total number of
// outstanding HTLC's we can add to a link's commitment transaction.
// outstanding HTLCs we can add to a link's commitment transaction.
// This channel is essentially used as a semaphore.
slots chan struct{}

Expand Down Expand Up @@ -642,9 +642,9 @@ func (h *htlcSwitch) handleRegisterLink(req *registerLinkMsg) {
chanPoint: chanPoint,
}

// To ensure we never accidentally cause an HTLC overflow, we'll limit,
// To ensure we never accidentally cause an HTLC overflow,
// we'll use this buffered channel as as semaphore in order to limit
// the number of outstanding HTLC's we extend to the target link.
// the number of outstanding HTLCs we extend to the target link.
//const numSlots = (lnwallet.MaxHTLCNumber / 2) - 1
const numSlots = lnwallet.MaxHTLCNumber - 5
newLink.boundedLinkChan = newBoundedLinkChan(numSlots, req.linkChan)
Expand Down
10 changes: 5 additions & 5 deletions lnd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ peersPoll:
closeChannelAndAssert(ctxt, t, net, net.Alice, chanPoint, true)
}

// testChannelBalance creates a new channel between Alice and Bob, then
// testChannelBalance creates a new channel between Alice and Bob, then
// checks channel balance to be equal amount specified while creation of channel.
func testChannelBalance(net *networkHarness, t *harnessTest) {
timeout := time.Duration(time.Second * 5)
Expand Down Expand Up @@ -468,7 +468,7 @@ func testChannelBalance(net *networkHarness, t *harnessTest) {
}

// As this is a single funder channel, Alice's balance should be
// exactly 0.5 BTC since now state transitions have taken place yet.
// exactly 0.5 BTC since no state transitions have taken place yet.
checkChannelBalance(net.Alice, amount)

// Ensure Bob currently has no available balance within the channel.
Expand Down Expand Up @@ -1451,7 +1451,7 @@ func testRevokedCloseRetribution(net *networkHarness, t *harnessTest) {
bobPaymentHashes[i] = resp.RHash
}

// As we'll be querying the state of bob's channels frequently we'll
// As we'll be querying the state of Bob's channels frequently we'll
// create a closure helper function for the purpose.
getBobChanInfo := func() (*lnrpc.ActiveChannel, error) {
req := &lnrpc.ListChannelsRequest{}
Expand Down Expand Up @@ -1729,7 +1729,7 @@ out:
}
}

// With the channels, open we can now start to test our multi-hop error
// With the channels open, we can now start to test our multi-hop error
// scenarios. First, we'll generate an invoice from carol that we'll
// use to test some error cases.
const payAmt = 10000
Expand Down Expand Up @@ -1825,7 +1825,7 @@ out:
}

// To do so, we'll push most of the funds in the channel over to
// Alice's side, leaving on 10k satoshis of available balance for bob.
// Alice's side, leaving on 10k satoshis of available balance for Bob.
invoiceReq = &lnrpc.Invoice{
Value: int64(chanAmt) - 10000,
}
Expand Down
2 changes: 1 addition & 1 deletion lnwallet/btcwallet/btcwallet.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ func New(cfg *Config) (*BtcWallet, error) {
//
// This is a part of the WalletController interface.
func (b *BtcWallet) Start() error {
// Establish an RPC connection in additino to starting the goroutines
// Establish an RPC connection in addition to starting the goroutines
// in the underlying wallet.
if err := b.rpc.Start(); err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion lnwallet/channel.go
Original file line number Diff line number Diff line change
Expand Up @@ -1799,7 +1799,7 @@ func (lc *LightningChannel) RevokeCurrentCommitment() (*lnwire.RevokeAndAck, err
// windows are extended, or in response to a state update that we initiate. If
// successful, then the remote commitment chain is advanced by a single
// commitment, and a log compaction is attempted. In addition, a slice of
// HTLC's which can be forwarded upstream are returned.
// HTLCs which can be forwarded upstream are returned.
func (lc *LightningChannel) ReceiveRevocation(revMsg *lnwire.RevokeAndAck) ([]*PaymentDescriptor, error) {
lc.Lock()
defer lc.Unlock()
Expand Down
4 changes: 2 additions & 2 deletions lnwallet/channel_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ func TestSimpleAddSettleWorkflow(t *testing.T) {
}

// Bob receives this signature message, revokes his prior commitment
// given to him by Alice,a nd then finally send a signature for Alice's
// given to him by Alice, and then finally send a signature for Alice's
// commitment transaction.
if err := bobChannel.ReceiveNewCommitment(aliceSig); err != nil {
t.Fatalf("bob unable to process alice's new commitment: %v", err)
Expand Down Expand Up @@ -1271,7 +1271,7 @@ func TestStateUpdatePersistence(t *testing.T) {
t.Fatalf("unable to recv bob's htlc: %v", err)
}

// Next, Alice initiates a state transition to include the HTLC's she
// Next, Alice initiates a state transition to include the HTLCs she
// added above in a new commitment state.
if err := forceStateTransition(aliceChannel, bobChannel); err != nil {
t.Fatalf("unable to complete alice's state transition: %v", err)
Expand Down
2 changes: 1 addition & 1 deletion lnwallet/interface_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1149,7 +1149,7 @@ func testSignOutputPrivateTweak(r *rpctest.Harness, w *lnwallet.LightningWallet,
outputIndex = 1
}

/// WIth the index located, we can create a transaction spending the
/// With the index located, we can create a transaction spending the
//referenced output.
sweepTx := wire.NewMsgTx(2)
sweepTx.AddTxIn(&wire.TxIn{
Expand Down
2 changes: 1 addition & 1 deletion lnwallet/script_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ func senderHTLCScript(absoluteTimeout, relativeTimeout uint32, senderKey,
builder.AddOp(txscript.OP_ELSE)

// In this case, the sender will need to wait for an absolute HTLC
// timeout, then afterwards a relative timeout before we claim re-claim
// timeout, then afterwards a relative timeout before we re-claim
// the unsettled funds. This delay gives the other party a chance to
// present the preimage to the revocation hash in the event that the
// sender (at this time) broadcasts this commitment transaction after
Expand Down
2 changes: 1 addition & 1 deletion lnwallet/wallet.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ type addSingleFunderSigsMsg struct {
// a channel. However, once the chainntnfs package is complete, the wallet
// will be compatible with multiple RPC/notification services such as Electrum,
// Bitcoin Core + ZeroMQ, etc. Eventually, the wallet won't require a full-node
// at all, as SPV support is integrated inot btcwallet.
// at all, as SPV support is integrated into btcwallet.
type LightningWallet struct {
// This mutex is to be held when generating external keys to be used
// as multi-sig, and commitment keys within the channel.
Expand Down
6 changes: 3 additions & 3 deletions lnwire/announcement_signatures.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/roasbeef/btcd/wire"
)

// AnnounceSignatures this is a direct message between two endpoints of a
// AnnounceSignatures is a direct message between two endpoints of a
// channel and serves as an opt-in mechanism to allow the announcement of
// the channel to the rest of the network. It contains the necessary
// signatures by the sender to construct the channel announcement message.
Expand All @@ -26,12 +26,12 @@ type AnnounceSignatures struct {
ShortChannelID ShortChannelID

// NodeSignature is the signature which contains the signed announce
// channel message, by this signature we proof that we posses of the
// channel message, by this signature we prove that we posses of the
// node pub key and creating the reference node_key -> bitcoin_key.
NodeSignature *btcec.Signature

// BitcoinSignature is the signature which contains the signed node
// public key, by this signature we proof that we posses of the
// public key, by this signature we prove that we posses of the
// bitcoin key and and creating the reverse reference bitcoin_key ->
// node_key.
BitcoinSignature *btcec.Signature
Expand Down
8 changes: 4 additions & 4 deletions lnwire/channel_announcement.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ import (
// between two peers in the overlay, which is propagated by the discovery
// service over broadcast handler.
type ChannelAnnouncement struct {
// This signatures are used by nodes in order to create cross
// These signatures are used by nodes in order to create cross
// references between node's channel and node. Requiring both nodes
// to sign indicates they are both willing to route other payments via
// this node.
NodeSig1 *btcec.Signature
NodeSig2 *btcec.Signature

// This signatures are used by nodes in order to create cross
// These signatures are used by nodes in order to create cross
// references between node's channel and node. Requiring the bitcoin
// signatures proves they control the channel.
BitcoinSig1 *btcec.Signature
Expand All @@ -28,12 +28,12 @@ type ChannelAnnouncement struct {
ShortChannelID ShortChannelID

// The public keys of the two nodes who are operating the channel, such
// that is NodeID1 the numerically-lesser than NodeID2 (ascending
// that NodeID1 is numerically-lesser than NodeID2 (ascending
// numerical order).
NodeID1 *btcec.PublicKey
NodeID2 *btcec.PublicKey

// Public keys which corresponds to the keys which was declared in
// Public keys which corresponds to the keys which were declared in
// multisig funding transaction output.
BitcoinKey1 *btcec.PublicKey
BitcoinKey2 *btcec.PublicKey
Expand Down
2 changes: 1 addition & 1 deletion lnwire/channel_update_announcement.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ var _ Message = (*ChannelUpdateAnnouncement)(nil)
func (a *ChannelUpdateAnnouncement) Validate() error {
// NOTE: As far as we don't have the node id (public key) in this
// message, we can't validate the signature on this stage, it should
// be validated latter - in discovery service handler.
// be validated later - in discovery service handler.

if a.TimeLockDelta == 0 {
return errors.New("expiry should be greater then zero")
Expand Down
2 changes: 1 addition & 1 deletion lnwire/close_complete.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"io"
)

// CloseComplete is sent by Bob signalling a fufillment and completion of
// CloseComplete is sent by Bob signalling a fulfillment and completion of
// Alice's prior CloseRequest message. After Alice receives Bob's CloseComplete
// message, she is able to broadcast the fully signed transaction executing a
// cooperative closure of the channel.
Expand Down
8 changes: 4 additions & 4 deletions lnwire/commit_sig.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ import (
"github.com/roasbeef/btcd/wire"
)

// CommitSig is sent by either side to stage any pending HTLC's in the
// CommitSig is sent by either side to stage any pending HTLCs in the
// receiver's pending set into a new commitment state. Implicitly, the new
// commitment transaction constructed which has been signed by CommitSig
// includes all HTLC's in the remote node's pending set. A CommitSig message
// includes all HTLCs in the remote node's pending set. A CommitSig message
// may be sent after a series of UpdateAddHTLC/UpdateFufillHTLC messages in
// order to batch add several HTLC's with a single signature covering all
// implicitly accepted HTLC's.
// order to batch add several HTLCs with a single signature covering all
// implicitly accepted HTLCs.
type CommitSig struct {
// ChannelPoint uniquely identifies to which currently active channel
// this CommitSig applies to.
Expand Down
22 changes: 11 additions & 11 deletions lnwire/features.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ func NewFeatureVectorFromReader(r io.Reader) (*FeatureVector, error) {

// Encode encodes the features vector into bytes representation, every feature
// encoded as 2 bits where odd bit determine whether the feature is "optional"
// and even bit told us whether the feature is "required". The even/odd
// and even bit tell us whether the feature is "required". The even/odd
// semantic allows future incompatible changes, or backward compatible changes.
// Bits generally assigned in pairs, so that optional features can later become
// compulsory.
Expand Down Expand Up @@ -203,7 +203,7 @@ func (f *FeatureVector) Encode(w io.Writer) error {

// Compare checks that features are compatible and returns the features which
// were present in both remote and local feature vectors. If remote/local node
// doesn't have the feature and local/remote node require it than such vectors
// doesn't have the feature and local/remote node require it then such vectors
// are incompatible.
func (f *FeatureVector) Compare(f2 *FeatureVector) (*SharedFeatures, error) {
shared := newSharedFeatures(f.Copy())
Expand All @@ -215,14 +215,14 @@ func (f *FeatureVector) Compare(f2 *FeatureVector) (*SharedFeatures, error) {
return nil, errors.New("Remote node hasn't " +
"locally required feature")
case OptionalFlag:
// If feature is optional and remote side
// haven't it than it might be safely disabled.
// If feature is optional and remote side doesn't
// have it then it might be safely disabled.
delete(shared.flags, index)
continue
}
}

// If feature exists on both sides than such feature might be
// If feature exists on both sides then such feature might be
// considered as active.
shared.flags[index] = flag
}
Expand All @@ -234,22 +234,22 @@ func (f *FeatureVector) Compare(f2 *FeatureVector) (*SharedFeatures, error) {
return nil, errors.New("Local node hasn't " +
"locally required feature")
case OptionalFlag:
// If feature is optional and local side
// haven't it than it might be safely disabled.
// If feature is optional and local side doesn't
// have it then it might be safely disabled.
delete(shared.flags, index)
continue
}
}

// If feature exists on both sides than such feature might be
// If feature exists on both sides then such feature might be
// considered as active.
shared.flags[index] = flag
}

return shared, nil
}

// Copy generate new distinct instance of the feature vector.
// Copy generates new distinct instance of the feature vector.
func (f *FeatureVector) Copy() *FeatureVector {
features := make([]Feature, len(f.featuresMap))

Expand All @@ -276,12 +276,12 @@ func newSharedFeatures(f *FeatureVector) *SharedFeatures {
}

// IsActive checks is feature active or not, it might be disabled during
// comparision with remote feature vector if it was optional and remote peer
// comparison with remote feature vector if it was optional and remote peer
// doesn't support it.
func (f *SharedFeatures) IsActive(name featureName) bool {
index, ok := f.featuresMap[name]
if !ok {
// If we even have no such feature in feature map, than it
// If we even have no such feature in feature map, then it
// can't be active in any circumstances.
return false
}
Expand Down
4 changes: 2 additions & 2 deletions lnwire/features_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func TestFeaturesRemoteRequireError(t *testing.T) {
}

// TestFeaturesLocalRequireError checks that we throw an error if local peer has
// required feature which remote peer don't support.
// required feature which remote peer doesn't support.
func TestFeaturesLocalRequireError(t *testing.T) {
const (
first = "first"
Expand All @@ -52,7 +52,7 @@ func TestFeaturesLocalRequireError(t *testing.T) {
}
}

// TestOptionalFeature checks that if remote peer don't have the feature but
// TestOptionalFeature checks that if remote peer doesn't have the feature but
// on our side this feature is optional than we mark this feature as disabled.
func TestOptionalFeature(t *testing.T) {
const first = "first"
Expand Down
2 changes: 1 addition & 1 deletion lnwire/funding_locked.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ type FundingLocked struct {
}

// NewFundingLocked creates a new FundingLocked message, populating it with
// the necessary IDs and revocation secret..
// the necessary IDs and revocation secret.
func NewFundingLocked(op wire.OutPoint, cid ShortChannelID,
npcp *btcec.PublicKey) *FundingLocked {
return &FundingLocked{
Expand Down
6 changes: 3 additions & 3 deletions lnwire/init_message.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ import (
"io"
)

// Init is the first message reveals the features supported or required by this
// node. Nodes wait for receipt of the other's features to simplify error
// Init is the first message and reveals the features supported or required by
// this node. Nodes wait for receipt of the other's features to simplify error
// diagnosis where features are incompatible. Each node MUST wait to receive
// init before sending any other messages.
type Init struct {
// GlobalFeatures is feature vector which affects HTLCs and thus are
// also advertised to other nodes.
GlobalFeatures *FeatureVector

// LocalFeatures is feature vector which only affect the protocol
// LocalFeatures is feature vector which only affects the protocol
// between two nodes.
LocalFeatures *FeatureVector
}
Expand Down

0 comments on commit 4c7aec2

Please sign in to comment.