MCPcopy Create free account
hub / github.com/ElementsProject/lightning / new_onchain_fee

Function new_onchain_fee

plugins/bkpr/onchain_fee.c:108–141  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

106}
107
108static struct onchain_fee *new_onchain_fee(struct onchain_fees *onchain_fees,
109 const char *acct_name TAKES,
110 const struct bitcoin_txid *txid,
111 struct amount_msat credit,
112 struct amount_msat debit,
113 u64 timestamp,
114 u32 update_count)
115{
116 struct onchain_fee *of = tal(NULL, struct onchain_fee);
117 struct ordered_ofees *ofees;
118
119 of->acct_name = tal_strdup(of, acct_name);
120 of->txid = *txid;
121 of->credit = credit;
122 of->debit = debit;
123 of->timestamp = timestamp;
124 of->update_count = update_count;
125
126 /* Add to sorted array in hash table */
127 ofees = ofees_hash_get(onchain_fees->by_account, of->acct_name);
128 if (ofees) {
129 tal_arr_expand(&ofees->ofs, of);
130 order_fees(ofees->ofs);
131 } else {
132 ofees = tal(onchain_fees->by_account, struct ordered_ofees);
133 ofees->ofs = tal_arr(ofees, struct onchain_fee *, 1);
134 ofees->ofs[0] = of;
135 ofees_hash_add(onchain_fees->by_account, ofees);
136 }
137 tal_steal(ofees->ofs, of);
138
139 tal_add_destructor2(of, destroy_onchain_fee, onchain_fees->by_account);
140 return of;
141}
142
143static void towire_onchain_fee(u8 **pptr, const struct onchain_fee *of)
144{

Callers 2

fromwire_onchain_feeFunction · 0.85
insert_chain_fees_diffFunction · 0.85

Calls 1

order_feesFunction · 0.85

Tested by

no test coverage detected