This repository has been archived by the owner on Aug 2, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 110
swap: prevent bad cheques from being sent #1925
Draft
mortelli
wants to merge
51
commits into
master
Choose a base branch
from
swap-prevent-bad-cheques
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
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
…eques # Conflicts: # swap/swap_test.go
…sentCheques function
mortelli
added
in progress
incentives
builds on open PR
Builds on a PR that is not yet merged. It is blocked until then and the diff won't make sense yet.
labels
Nov 1, 2019
…prevent-bad-cheques # Conflicts: # swap/swap.go
…prevent-bad-cheques
mortelli
removed
the
builds on open PR
Builds on a PR that is not yet merged. It is blocked until then and the diff won't make sense yet.
label
Nov 5, 2019
…eques # Conflicts: # swap/peer.go # swap/protocol_test.go # swap/swap.go
…eques # Conflicts: # swap/swap.go
also discussed on 19/11: we're going to wait for the new implementation of |
@mortelli , what is the status here? |
…eques # Conflicts: # swap/simulations_test.go # swap/swap_test.go
still in progress, but not actively being worked on right now |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
WIP
This PR modifies the SWAP
Add
function so that chequebook balance is inspected before writing acheque.
If the cheque's increase of cumulative payout is larger than the chequebook's available balance, the cheque will not be set nor sent and an error will be returned.
closes #1885
Current Issues
Cheques
function had to be (temporarily) commented out.Add
activates a peer lock when called, and onceAvailableBalance
was called during accounting, it attempts to call theCheques
function. As an RPC,Cheques
attempts to hold this peer lock as well, which causes a deadlock.i'm not convinced with the idea of using RPCs internally, i.e. for "regular" SWAP logic. i'd prefer (at least) wrapper functions for RPCs which are not used anywhere else.this also may bring back the discussion of whether (or not) to have specific functions for sent and received cheques (see points raised by @acud on swap: expand RPC calls for cheque info querying #1863), be it for a specific peer or for all of them.this now also has to be updated to include pending cheques instead, when they exist.TestMultiChequeSimulation
is failing with its originalmaxCheques
value of10
, since it seems the cumulative payouts amount to more than the chequebook's available balance.