diff --git a/test/functional/wallet_silentpayments_receiving.py b/test/functional/wallet_silentpayments_receiving.py index 624dc927e24efd..698bbd73402c12 100755 --- a/test/functional/wallet_silentpayments_receiving.py +++ b/test/functional/wallet_silentpayments_receiving.py @@ -20,6 +20,31 @@ def skip_test_if_missing_module(self): self.skip_if_no_wallet() self.skip_if_no_sqlite() + def test_labels(self): + self.log.info("Check Silent Payment Labels") + + self.nodes[0].createwallet(wallet_name="labels", silent_payment=True) + wallet = self.nodes[0].get_wallet_rpc("labels") + + labeled_sp_addr = wallet.getnewaddress(address_type="silent-payment", label="test") + addr_info = wallet.getaddressinfo(labeled_sp_addr) + assert addr_info["labels"][0] == "test" + assert wallet.listlabels() == ["test"] + assert_raises_rpc_error(-11, "No addresses with label test", wallet.getaddressesbylabel, "test") # SP destination is ignored + + txid = self.def_wallet.sendtoaddress(labeled_sp_addr, 10) + self.generate(self.nodes[0], 1) + + addresses = wallet.getaddressesbylabel("test") + sp_taproot_spk_addr = list(addresses)[0] + assert len(addresses) == 1 + assert addresses[sp_taproot_spk_addr]["purpose"] == "receive" + assert wallet.getaddressinfo(sp_taproot_spk_addr)["labels"][0] == "test" + wallet_txs_by_label = wallet.listreceivedbylabel() + assert wallet_txs_by_label[0]["amount"] == 10 + assert wallet_txs_by_label[0]["label"] == "test" + assert wallet.getreceivedbylabel("test") == 10 + def test_encrypt_and_decrypt(self): self.log.info("Check that a silent payments wallet can be encrypted and decrypted") self.log.info("Create encrypted wallet") @@ -171,6 +196,7 @@ def run_test(self): self.test_encrypting_unencrypted() self.test_basic() self.test_import_rescan() + self.test_labels() if __name__ == '__main__':