-
Notifications
You must be signed in to change notification settings - Fork 100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
client: Babysit refund transactions. #3082
base: master
Are you sure you want to change the base?
Conversation
bee4875
to
9491c14
Compare
31a4c6b
to
c6f14c0
Compare
a50edc8
to
5a4b56a
Compare
Looks good! |
client/db/bolt/upgrades.go
Outdated
amb := []byte("matches") // archived matches | ||
|
||
var nRefunded int | ||
|
||
defer func() { | ||
upgradeLog.Infof("%d inactive refunded matches set to confirmed status", nRefunded) | ||
}() | ||
|
||
archivedMatchesBkt := dbtx.Bucket(amb) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
amb := []byte("matches") // archived matches | |
var nRefunded int | |
defer func() { | |
upgradeLog.Infof("%d inactive refunded matches set to confirmed status", nRefunded) | |
}() | |
archivedMatchesBkt := dbtx.Bucket(amb) | |
var nRefunded int | |
defer func() { | |
upgradeLog.Infof("%d inactive refunded matches set to confirmed status", nRefunded) | |
}() | |
archivedMatchesBkt := dbtx.Bucket(activeMatchesBucket) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want to avoid using any outside variables in the upgrade, that way changes to surrounding code will not affect it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess I should also apply this to matchKey and proofKey...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or did you mean to change to activeMatchesBucket
? I don't think those can be revoked yet?
client/core/trade.go
Outdated
if _, is := t.accountRefunder(); is { | ||
feeSuggestion = t.metaData.MaxFeeRate | ||
} else { | ||
feeSuggestion = t.redeemFeeSuggestion.get() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This case would be incorrect, since it's using the fee suggestion for the redeem asset.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yeah... I think I meant to come back to this. I guess doing the same as for redeems.
// | ||
// This method accesses match fields and MUST be called with the trackedTrade | ||
// mutex lock held for writes. | ||
func (c *Core) confirmRefund(t *trackedTrade, match *matchTracker) (bool, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about something like this to reduce the duplication between confirmRefund
and confirmRedemption
: 4067899
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using this. Thank you.
9dbd211
to
358a1bb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've been testing and I see a few issues:
- When I do ETH/BTC swap, the side that is redeeming BTC cannot confirm the redemption:
- When force a refund for eth, and then replace the transaction with another one with the same nonce, the popup for resubmitting the refund does not show up. If I restart
bisonw
, it shows up though. I tested this by using the test which I updated here: 0fe42e5 . You can update the seed and the nonce of the transaction that you want to have replaced, then run the test while waiting for the refund. Then you press enter right as the refund is submitted, and it will send a transaction with the same nonce, but a higher fee.
amb := []byte("matches") // archived matches | ||
mKey := []byte("match") // matchKey | ||
pKey := []byte("proof") // proofKey |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are already all defined in db.go.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes. For the upgrade I would rather freeze the exact values in time. It would be weird if the values the variables pointed to would change, I agree, but just to be safe.
358a1bb
to
39ee55b
Compare
@martonp Sorry I didnt rebase before pushing changes. The first point is probably fixed by the change in trade.go here https://github.com/decred/dcrdex/compare/358a1bb86d500748e189738b2808244a3618e1e6..39ee55b05b201f3c2d85c9558ed8624c1bd56e6c I tried testing the replace transactions but I'm not sure if I'm blocking something bisonw needs for popups... I'll try some more. |
39ee55b
to
2eedfb3
Compare
Oh yeah, I'm only seeing the popup after restarting. hmmm... |
@martonp it is based on this timeout for a running instance dcrdex/client/asset/eth/eth.go Lines 108 to 110 in 0030e49
The tx should become stale and you will see the popup after that interval. You can reduce it ofc to check. |
ActionIDRedeemRejected = "redeemRejected" | ||
TopicRedeemRejected = "RedeemRejected" | ||
ActionIDRefundRejected = "refundRejected" | ||
TopicRefundRejected = "RefundRejected" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the UI the action was updated to txRejected
, so when these actions are sent, there is a UI error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yeah, thanks. I guess keeping two here as handleCoreAction
needs them to be different. Reverting the js change and adding refundRejected
2eedfb3
to
aef1889
Compare
Adding refundRejected to js switch https://github.com/decred/dcrdex/compare/2eedfb3da5ea45204465d030c8fa63274c536489..aef18891dd3d51ffc43a56a16479c674bc0d8275 |
closes #3063