Skip to content

Commit

Permalink
Detect reverted transactions (#355)
Browse files Browse the repository at this point in the history
* Detect reverted transactions

* Add reverted amount to funds display

* Support cancelling reverted txs

* Add reverted_after field for reverted transactions

* Update grin dependency to master branch

* Panic on failed test cleanup

* Only delete test dir if it exists

* Stop wallet proxy in accounts test

* Stop proxy thread in all controller tests

* Typo

* Add sleep after revert test

* Longer sleep in revert tests
  • Loading branch information
jaspervdm committed Mar 10, 2020
1 parent 63eb25a commit 7a95f42
Show file tree
Hide file tree
Showing 7 changed files with 667 additions and 40 deletions.
3 changes: 3 additions & 0 deletions api/src/owner_rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ pub trait OwnerRpc {
"ttl_cutoff_height": null,
"tx_slate_id": null,
"payment_proof": null,
"reverted_after": null,
"tx_type": "ConfirmedCoinbase"
},
{
Expand All @@ -289,6 +290,7 @@ pub trait OwnerRpc {
"stored_tx": null,
"ttl_cutoff_height": null,
"payment_proof": null,
"reverted_after": null,
"tx_slate_id": null,
"tx_type": "ConfirmedCoinbase"
}
Expand Down Expand Up @@ -340,6 +342,7 @@ pub trait OwnerRpc {
"amount_currently_spendable": "60000000000",
"amount_immature": "180000000000",
"amount_locked": "0",
"amount_reverted": "0",
"last_confirmed_height": "4",
"minimum_confirmations": "1",
"total": "240000000000"
Expand Down
12 changes: 12 additions & 0 deletions controller/src/display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,12 @@ pub fn info(
bFG->"Confirmed Total",
FG->amount_to_hr_string(wallet_info.total, false)
]);
if wallet_info.amount_reverted > 0 {
table.add_row(row![
Fr->format!("Reverted"),
Fr->amount_to_hr_string(wallet_info.amount_reverted, false)
]);
}
// Only dispay "Immature Coinbase" if we have related outputs in the wallet.
// This row just introduces confusion if the wallet does not receive coinbase rewards.
if wallet_info.amount_immature > 0 {
Expand Down Expand Up @@ -337,6 +343,12 @@ pub fn info(
bFG->"Total",
FG->amount_to_hr_string(wallet_info.total, false)
]);
if wallet_info.amount_reverted > 0 {
table.add_row(row![
Fr->format!("Reverted"),
Fr->amount_to_hr_string(wallet_info.amount_reverted, false)
]);
}
// Only dispay "Immature Coinbase" if we have related outputs in the wallet.
// This row just introduces confusion if the wallet does not receive coinbase rewards.
if wallet_info.amount_immature > 0 {
Expand Down
Loading

0 comments on commit 7a95f42

Please sign in to comment.