lnwire+lnwallet+fundingmanager: general improvements

This commit is contained in:
Andrey Samokhvalov authored and Olaoluwa Osuntokun committed 2016-12-13 11:01:57 -08:00
1 parent a6f7f05323
commit 5a82240c6a
13 files changed
+146 -108

No files matched your search

+9
View File
@@ -5,12 +5,21 @@ import (
"io"
"github.com/roasbeef/btcd/wire"
"google.golang.org/grpc/codes"
)
// ErrorCode represents the short error code for each of the defined errors
// within the Lightning Network protocol spec.
type ErrorCode uint16
// ToGrpcCode is used to generate gRPC specific code which will be propagated
// to the ln rpc client. This code is used to have more detailed view of what
// goes wrong and also in order to have the ability pragmatically determine
// the error and take specific actions on the client side.
func (e ErrorCode) ToGrpcCode() codes.Code {
return (codes.Code)(e) + 100
}
const (
// ErrorMaxPendingChannels is returned by remote peer when the number
// of active pending channels exceeds their maximum policy limit.
+2 -1
View File
@@ -5,6 +5,7 @@ import (
"io"
"github.com/roasbeef/btcd/wire"
"github.com/roasbeef/btcutil"
)
// HTLCAddRequest is the message sent by Alice to Bob when she wishes to add an
@@ -28,7 +29,7 @@ type HTLCAddRequest struct {
// Difference between hop and first item in blob is the fee to complete
// Amount is the number of credits this HTLC is worth.
Amount CreditsAmount
Amount btcutil.Amount
// RefundContext is for payment cancellation
// TODO(j): not currently in use, add later
+2 -1
View File
@@ -4,6 +4,7 @@ import (
"bytes"
"reflect"
"testing"
"github.com/roasbeef/btcutil"
)
func TestHTLCAddRequestEncodeDecode(t *testing.T) {
@@ -14,7 +15,7 @@ func TestHTLCAddRequestEncodeDecode(t *testing.T) {
addReq := &HTLCAddRequest{
ChannelPoint: outpoint1,
Expiry: uint32(144),
Amount: CreditsAmount(123456000),
Amount: btcutil.Amount(123456000),
ContractType: uint8(17),
RedemptionHashes: redemptionHashes,
OnionBlob: []byte{255, 0, 255, 0, 255, 0, 255, 0},
+1 -1
View File
@@ -32,7 +32,7 @@ type HTLCKey int64
// HTLC lists on either side will increment this height. As a result this value
// should always be monotonically increasing. Any CommitSignature or
// CommitRevocation messages will reference a value for the commitment height
// up to which it covers. HTLC's are only explicltly excluded by sending
// up to which it covers. HTLC's are only explicitly excluded by sending
// HTLCReject messages referencing a particular HTLCKey.
type CommitHeight uint64