mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-01 08:44:02 +02:00
Merge bitcoin/bitcoin#25934: wallet, rpc: add label to listsinceblock
4e362c2b72doc: add release note for 25934 (brunoerg)fe488b4c4btest: add coverage for `label` in `listsinceblock` (brunoerg)722e9a418dwallet, rpc: add `label` to `listsinceblock` (brunoerg)852891ff98refactor, wallet: use optional for `label` in `ListTransactions` (brunoerg) Pull request description: This PR adds `label` parameter to `listsinceblock` to be able to fetch all incoming transactions having the specified label since a specific block. It's possible to use it in `listtransactions`, however, it's only possible to set the number of transactions to return, not a specific block to fetch from. `getreceivedbylabel` only returns the total amount received, not the txs info. `listreceivedbylabel` doesn't list all the informations about the transactions and it's not possible to fetch since a block. ACKs for top commit: achow101: ACK4e362c2b72w0xlt: ACK4e362c2b72aureleoules: ACK4e362c2b72Tree-SHA512: fbde5db8cebf7a27804154fa61997b5155ad512e978cebb78c17acab9efcb624ea5f39d649899d12e5e675f80d4d0064cae8132b864de0d93a8d1e6fbcb9a737
This commit is contained in:
@@ -49,6 +49,7 @@ class ListSinceBlockTest(BitcoinTestFramework):
|
||||
self.test_desc()
|
||||
self.test_send_to_self()
|
||||
self.test_op_return()
|
||||
self.test_label()
|
||||
|
||||
def test_no_blockhash(self):
|
||||
self.log.info("Test no blockhash")
|
||||
@@ -465,6 +466,20 @@ class ListSinceBlockTest(BitcoinTestFramework):
|
||||
|
||||
assert 'address' not in op_ret_tx
|
||||
|
||||
def test_label(self):
|
||||
self.log.info('Test passing "label" argument fetches incoming transactions having the specified label')
|
||||
new_addr = self.nodes[1].getnewaddress(label="new_addr", address_type="bech32")
|
||||
|
||||
self.nodes[2].sendtoaddress(address=new_addr, amount="0.001")
|
||||
self.generate(self.nodes[2], 1)
|
||||
|
||||
for label in ["new_addr", ""]:
|
||||
new_addr_transactions = self.nodes[1].listsinceblock(label=label)["transactions"]
|
||||
assert_equal(len(new_addr_transactions), 1)
|
||||
assert_equal(new_addr_transactions[0]["label"], label)
|
||||
if label == "new_addr":
|
||||
assert_equal(new_addr_transactions[0]["address"], new_addr)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
ListSinceBlockTest().main()
|
||||
|
||||
Reference in New Issue
Block a user