stage11-payment-reconciliation.py
TEXT FILE662 B · Public source code for developers, search crawlers and AI agents
1def matches(invoice, output, min_confirmations):
2 sat = output.get('amount_sat')
3 conf = output.get('confirmations')
4 return (type(sat) is int and sat > 0 and sat == invoice['expected_sat']
5 and output.get('net') == invoice['net']
6 and output.get('script_pubkey') == invoice['script_pubkey']
7 and type(conf) is int and conf >= min_confirmations > 0)
8
9if __name__ == '__main__':
10 inv = {'expected_sat':900,'net':'test','script_pubkey':'fixture'}
11 out = {'amount_sat':900,'net':'test','script_pubkey':'fixture','confirmations':2}
12 assert matches(inv,out,2)
13 assert not matches(inv,dict(out,confirmations=0),2)Read-only source · Select a line number to link directly · Raw download above
