chanfunding: adds ability to fund up to some maximum amount
Allows to define a maximum amount to provision a channel opening with using a new field `FundUpToMaxAmt` on the `Request` struct. Also adds a new coin select function `CoinSelectUpToAmount` to select coins up to a maximum amount respecting a minimum amount.
This commit is contained in:
1 parent
f97454d4ff
commit
0c8aa81ed5
6 files changed
+370
-7
No files matched your search
@@ -195,13 +195,21 @@ func NewCannedAssembler(thawHeight uint32, chanPoint wire.OutPoint,
|
||||
//
|
||||
// NOTE: This method satisfies the chanfunding.Assembler interface.
|
||||
func (c *CannedAssembler) ProvisionChannel(req *Request) (Intent, error) {
|
||||
// We'll exit out if this field is set as the funding transaction has
|
||||
// already been assembled, so we don't influence coin selection..
|
||||
// We'll exit out if SubtractFees is set as the funding transaction has
|
||||
// already been assembled, so we don't influence coin selection.
|
||||
if req.SubtractFees {
|
||||
return nil, fmt.Errorf("SubtractFees ignored, funding " +
|
||||
"transaction is frozen")
|
||||
}
|
||||
|
||||
// We'll exit out if FundUpToMaxAmt or MinFundAmt is set as the funding
|
||||
// transaction has already been assembled, so we don't influence coin
|
||||
// selection.
|
||||
if req.FundUpToMaxAmt != 0 || req.MinFundAmt != 0 {
|
||||
return nil, fmt.Errorf("FundUpToMaxAmt and MinFundAmt " +
|
||||
"ignored, funding transaction is frozen")
|
||||
}
|
||||
|
||||
intent := &ShimIntent{
|
||||
localKey: c.localKey,
|
||||
remoteKey: c.remoteKey,
|
||||
|
||||
Reference in new issue
Block a user