mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-11-20 02:27:51 +01:00
5f41d9247e
onchain fees are weird at channel close because: - you may be missing an trimmed htlc (which went to fees) - the balance from close may have been rounded (msats cant land on chain) - the close might have been a past state and you've actually ended up with more money onchain than you had in the channel. wut This commit accounts for all of this appropriately, with some tests. channel_close.debit should equal onchain_fee.credit (for that txid) plus sum(chain_event.credit [wallet/channel_acct]). In the penalty case, channel_close.debit becomes channel_close.debit + penalty_adj.debit, i.e. channel-close.debit + (penalty_adj.debit) = onchain_fee.credit + sum(chain_event.credit [wallet/channel_acct])
17 lines
501 B
C
17 lines
501 B
C
#ifndef LIGHTNING_PLUGINS_BKPR_ACCOUNT_ENTRY_H
|
|
#define LIGHTNING_PLUGINS_BKPR_ACCOUNT_ENTRY_H
|
|
#include "config.h"
|
|
|
|
#define NUM_ACCOUNT_ENTRY_TAGS (JOURNAL_ENTRY + 1)
|
|
enum account_entry_tag {
|
|
JOURNAL_ENTRY = 0,
|
|
PENALTY_ADJ = 1,
|
|
};
|
|
|
|
/* Convert an enum into a string */
|
|
const char *account_entry_tag_str(enum account_entry_tag tag);
|
|
|
|
/* True if entry tag found, false otherwise */
|
|
bool account_entry_tag_find(char *str, enum account_entry_tag *tag);
|
|
#endif /* LIGHTNING_PLUGINS_BKPR_ACCOUNT_ENTRY_H */
|