-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Track deals funding for deals that are being negotiated (#336)
* Track deals funding for deals that are being negotiated * Handle errors coming from DealFunds * Update docs * Backfill some tests * feat(storagemarket): release funds properly Release funds any time a deal fails, not just due to ensure funds error Co-authored-by: hannahhoward <hannah@hannahhoward.net>
- Loading branch information
1 parent
c4c6b77
commit cca934d
Showing
26 changed files
with
545 additions
and
20 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package shared_testutil | ||
|
||
import ( | ||
"github.com/filecoin-project/specs-actors/actors/abi" | ||
"github.com/filecoin-project/specs-actors/actors/abi/big" | ||
|
||
"github.com/filecoin-project/go-fil-markets/storagemarket/impl/funds" | ||
) | ||
|
||
func NewTestDealFunds() *TestDealFunds { | ||
return &TestDealFunds{ | ||
reserved: big.Zero(), | ||
} | ||
} | ||
|
||
type TestDealFunds struct { | ||
reserved abi.TokenAmount | ||
ReserveCalls []abi.TokenAmount | ||
ReleaseCalls []abi.TokenAmount | ||
} | ||
|
||
func (f *TestDealFunds) Get() abi.TokenAmount { | ||
return f.reserved | ||
} | ||
|
||
func (f *TestDealFunds) Reserve(amount abi.TokenAmount) (abi.TokenAmount, error) { | ||
f.reserved = big.Add(f.reserved, amount) | ||
f.ReserveCalls = append(f.ReserveCalls, amount) | ||
return f.reserved, nil | ||
} | ||
|
||
func (f *TestDealFunds) Release(amount abi.TokenAmount) (abi.TokenAmount, error) { | ||
f.reserved = big.Sub(f.reserved, amount) | ||
f.ReleaseCalls = append(f.ReleaseCalls, amount) | ||
return f.reserved, nil | ||
} | ||
|
||
var _ funds.DealFunds = &TestDealFunds{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.