Return unspent transaction outputs in wallet Outputs will have between minconf and maxconf (inclusive) confirmations, optionally filtered to only include txouts paid to addresses in addrs.
(self, minconf=0, maxconf=9999999, addrs=None)
| 661 | return r |
| 662 | |
| 663 | def listunspent(self, minconf=0, maxconf=9999999, addrs=None): |
| 664 | """Return unspent transaction outputs in wallet |
| 665 | |
| 666 | Outputs will have between minconf and maxconf (inclusive) |
| 667 | confirmations, optionally filtered to only include txouts paid to |
| 668 | addresses in addrs. |
| 669 | """ |
| 670 | r = None |
| 671 | if addrs is None: |
| 672 | r = self._call('listunspent', minconf, maxconf) |
| 673 | else: |
| 674 | addrs = [str(addr) for addr in addrs] |
| 675 | r = self._call('listunspent', minconf, maxconf, addrs) |
| 676 | |
| 677 | r2 = [] |
| 678 | for unspent in r: |
| 679 | unspent['outpoint'] = COutPoint(lx(unspent['txid']), unspent['vout']) |
| 680 | del unspent['txid'] |
| 681 | del unspent['vout'] |
| 682 | |
| 683 | # address isn't always available as Bitcoin Core allows scripts w/o |
| 684 | # an address type to be imported into the wallet, e.g. non-p2sh |
| 685 | # segwit |
| 686 | try: |
| 687 | unspent['address'] = CBitcoinAddress(unspent['address']) |
| 688 | except KeyError: |
| 689 | pass |
| 690 | unspent['scriptPubKey'] = CScript(unhexlify_str(unspent['scriptPubKey'])) |
| 691 | unspent['amount'] = int(unspent['amount'] * COIN) |
| 692 | r2.append(unspent) |
| 693 | return r2 |
| 694 | |
| 695 | def lockunspent(self, unlock, outpoints): |
| 696 | """Lock or unlock outpoints""" |
no test coverage detected