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

Function utxos_for_channel

tests/utils.py:228–254  ·  view source on GitHub ↗
(utxoset, channel_id)

Source from the content-addressed store, hash-verified

226
227
228def utxos_for_channel(utxoset, channel_id):
229 relevant_txids = []
230 chan_utxos = {}
231
232 def _add_relevant(txid, utxo):
233 if txid not in chan_utxos:
234 chan_utxos[txid] = []
235 chan_utxos[txid].append(utxo)
236
237 for txid, utxo_list in utxoset.items():
238 for utxo in utxo_list:
239 if utxo[0]['account_id'] == channel_id:
240 _add_relevant(txid, utxo)
241 relevant_txids.append(txid)
242 if utxo[1]:
243 relevant_txids.append(utxo[1]['spending_txid'])
244 elif txid in relevant_txids:
245 _add_relevant(txid, utxo)
246 if utxo[1]:
247 relevant_txids.append(utxo[1]['spending_txid'])
248
249 # if they're not well ordered, we'll leave some txids out
250 for txid in relevant_txids:
251 if txid not in chan_utxos:
252 chan_utxos[txid] = utxoset[txid]
253
254 return chan_utxos
255
256
257def matchup_events(u_set, evs, chans, tag_list):

Callers 1

check_utxos_channelFunction · 0.85

Calls 1

_add_relevantFunction · 0.85

Tested by

no test coverage detected