mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-03-26 01:33:02 +01:00
Notes on payment amount
This commit is contained in:
parent
266c121510
commit
b3f812e5da
@ -20,6 +20,9 @@ type FundingRequest struct {
|
||||
//which is a payment to the responder
|
||||
//(This can be used to fund the Reserve)
|
||||
//If the responder disagrees, then the funding request fails
|
||||
//THIS VALUE GOES INTO THE RESPONDER'S FUNDING AMOUNT
|
||||
//total requester input value = RequesterFundingAmount + PaymentAmount + "Total Change"
|
||||
//RequesterFundingAmount = "Available Balance" - RequesterReserveAmount
|
||||
PaymentAmount btcutil.Amount
|
||||
|
||||
//Minimum number of confirmations to validate transaction
|
||||
@ -169,10 +172,6 @@ func (c *FundingRequest) Validate() error {
|
||||
if c.PaymentAmount < 0 {
|
||||
return fmt.Errorf("This wallet requieres payment to be greater than zero.")
|
||||
}
|
||||
//The payment must be below our own contribution (less reserve kept for ourselves
|
||||
if c.PaymentAmount > c.RequesterFundingAmount-c.RequesterReserveAmount {
|
||||
return fmt.Errorf("Payment too large")
|
||||
}
|
||||
|
||||
//Make sure there's not more than 127 inputs
|
||||
if len(c.Inputs) > 127 {
|
||||
|
@ -14,8 +14,8 @@ type FundingSignAccept struct {
|
||||
}
|
||||
|
||||
func (c *FundingSignAccept) Decode(r io.Reader, pver uint32) error {
|
||||
//ReservationID (0/8)
|
||||
//CommitSig
|
||||
//ReservationID (8)
|
||||
//CommitSig (73)
|
||||
// First byte length then sig
|
||||
//FundingTXSigs
|
||||
// First byte is number of FundingTxSigs
|
||||
@ -40,7 +40,7 @@ func NewFundingSignAccept() *FundingSignAccept {
|
||||
//Serializes the item from the FundingSignAccept struct
|
||||
//Writes the data to w
|
||||
func (c *FundingSignAccept) Encode(w io.Writer, pver uint32) error {
|
||||
//ReservationID (8)
|
||||
//ReservationID
|
||||
//CommitSig
|
||||
//FundingTxSigs
|
||||
err := writeElements(w,
|
||||
|
@ -15,8 +15,8 @@ type FundingSignComplete struct {
|
||||
}
|
||||
|
||||
func (c *FundingSignComplete) Decode(r io.Reader, pver uint32) error {
|
||||
//ReservationID (0/8)
|
||||
//TxID
|
||||
//ReservationID (8)
|
||||
//TxID (32)
|
||||
//FundingTXSigs
|
||||
// First byte is number of FundingTxSigs
|
||||
// Sorted list of the requester's input signatures
|
||||
@ -40,9 +40,6 @@ func NewFundingSignComplete() *FundingSignComplete {
|
||||
//Serializes the item from the FundingSignComplete struct
|
||||
//Writes the data to w
|
||||
func (c *FundingSignComplete) Encode(w io.Writer, pver uint32) error {
|
||||
//ReservationID (8)
|
||||
//CommitSig
|
||||
//FundingTxSigs
|
||||
err := writeElements(w,
|
||||
c.ReservationID,
|
||||
c.TxID,
|
||||
|
@ -362,10 +362,10 @@ func readElement(r io.Reader, element interface{}) error {
|
||||
return err
|
||||
}
|
||||
hash, err := wire.NewShaHash(h[:])
|
||||
(*e).PreviousOutPoint.Hash = *hash
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
(*e).PreviousOutPoint.Hash = *hash
|
||||
//Index
|
||||
var idxBytes [4]byte
|
||||
_, err = io.ReadFull(r, idxBytes[:])
|
||||
|
Loading…
x
Reference in New Issue
Block a user