Notes on payment amount

This commit is contained in:
Joseph Poon authored and Olaoluwa Osuntokun committed 2016-01-14 23:56:09 -08:00
1 parent 266c121510
commit b3f812e5da
4 files changed
+9 -13

No files matched your search

+3 -4
View File
@@ -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 {
+3 -3
View File
@@ -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,
+2 -5
View File
@@ -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,
+1 -1
View File
@@ -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[:])