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

Function extract_utxos

tests/utils.py:194–215  ·  view source on GitHub ↗
(moves)

Source from the content-addressed store, hash-verified

192
193
194def extract_utxos(moves):
195 utxos = {}
196 for m in moves:
197 if 'utxo' not in m:
198 continue
199 m['utxo_txid'], m['vout'] = m['utxo'].split(':')
200 txid = m['utxo_txid']
201 if txid not in utxos:
202 utxos[m['utxo_txid']] = []
203
204 if 'spending_txid' not in m:
205 utxos[txid].append([m, None])
206 else:
207 evs = utxos[txid]
208 # it's a withdrawal, find the deposit and add to the pair
209 for ev in evs:
210 if ev[0]['vout'] == m['vout']:
211 ev[1] = m
212 if ev[0]['output_msat'] != m['output_msat']:
213 raise ValueError(f'output_msat does not match. expected {ev[0]}. actual {m}')
214 break
215 return utxos
216
217
218def print_utxos(utxos):

Callers 1

check_utxos_channelFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected