coin moves: record their attempted cheat (and our handling thereof)

For cheats, we do a little bit of weird accounting. First we 'update'
our on-ledger balance to be the entirety of the channel's balance. Then,
as outputs get resolved, we record the fees and outputs as withdrawals
from this amount.

It's possible that they might successfully 'cheat', in which case we
record those as 'penalty' but debits (not credits).
This commit is contained in:
lisa neigut
2020-04-01 21:48:39 -05:00
committed by Rusty Russell
parent 007a62a369
commit 6ee6cdc280
3 changed files with 145 additions and 12 deletions

View File

@@ -35,6 +35,9 @@ enum tx_type {
/* When we spend a delayed output (after cltv_expiry) */
OUR_DELAYED_RETURN_TO_WALLET,
/* When they spend a delayed output we were attempting to steal */
THEIR_DELAYED_CHEAT,
/* When we use revocation key to take output. */
OUR_PENALTY_TX,
@@ -57,6 +60,9 @@ enum output_type {
OUTPUT_TO_US,
DELAYED_OUTPUT_TO_THEM,
/* THEIR_REVOKED_UNILATERAL (they shouldn't be able to claim these) */
DELAYED_CHEAT_OUTPUT_TO_THEM,
/* OUR_UNILATERAL, or OUR_HTLC_TIMEOUT_TX */
DELAYED_OUTPUT_TO_US,
OUTPUT_TO_THEM,