From b72caadafa4ee2e28835de60f03cac10e52501f2 Mon Sep 17 00:00:00 2001 From: alex v Date: Mon, 25 Nov 2024 17:28:59 +0100 Subject: [PATCH] fixes --- src/blsct/tokens/predicate_exec.cpp | 4 +--- test/functional/blsct_nft.py | 26 +++++++++++++------------- test/functional/blsct_token.py | 26 +++++++++++++------------- 3 files changed, 27 insertions(+), 29 deletions(-) diff --git a/src/blsct/tokens/predicate_exec.cpp b/src/blsct/tokens/predicate_exec.cpp index 0bc61d3def591..5c1e2320f5226 100644 --- a/src/blsct/tokens/predicate_exec.cpp +++ b/src/blsct/tokens/predicate_exec.cpp @@ -16,9 +16,7 @@ bool ExecutePredicate(const ParsedPredicate& predicate, CCoinsViewCache& view, c if (fDisconnect) view.EraseToken(hash); else { - blsct::TokenInfo info; - info = predicate.GetTokenInfo(); - view.AddToken(hash, std::move(info)); + view.AddToken(hash, blsct::TokenInfo{predicate.GetTokenInfo()}); } return true; diff --git a/test/functional/blsct_nft.py b/test/functional/blsct_nft.py index 494862aa209a9..a6b72d796d9ea 100755 --- a/test/functional/blsct_nft.py +++ b/test/functional/blsct_nft.py @@ -20,7 +20,7 @@ def set_test_params(self): def skip_test_if_missing_module(self): self.skip_if_no_wallet() - + def run_test(self): self.log.info("Creating wallet1 with BLSCT") @@ -29,8 +29,8 @@ def run_test(self): #self.init_wallet(node=0, blsct=True) self.nodes[0].createwallet(wallet_name="wallet1", blsct=True) self.nodes[1].createwallet(wallet_name="wallet1", blsct=True) - wallet_info = self.nodes[0].get_wallet_rpc("wallet1") - wallet_info_2 = self.nodes[1].get_wallet_rpc("wallet1") + wallet = self.nodes[0].get_wallet_rpc("wallet1") + wallet_2 = self.nodes[1].get_wallet_rpc("wallet1") self.log.info("Loading wallet1") @@ -41,8 +41,8 @@ def run_test(self): self.log.info("Generating BLSCT address") # Generate a BLSCT address - blsct_address = wallet_info.getnewaddress(label="", address_type="blsct") - blsct_address_2 = wallet_info_2.getnewaddress(label="", address_type="blsct") + blsct_address = wallet.getnewaddress(label="", address_type="blsct") + blsct_address_2 = wallet_2.getnewaddress(label="", address_type="blsct") self.log.info(f"BLSCT address NODE 1: {blsct_address}") self.log.info(f"BLSCT address NODE 2: {blsct_address_2}") @@ -54,14 +54,14 @@ def run_test(self): self.log.info(f"Generated blocks: {len(block_hashes)}") # Check the balance of the wallet - balance = wallet_info.getbalance() + balance = wallet.getbalance() self.log.info(f"Balance in wallet1: {balance}") assert_equal(len(block_hashes), 101) assert balance > 0, "Balance should be greater than zero after mining" self.log.info("Creating NFT collection and mining 1 block") - token = self.nodes[0].createnft({"name": "Test"}, 1000) + token = wallet.createnft({"name": "Test"}, 1000) block_hashes = self.generatetoblsctaddress(self.nodes[0], 1, blsct_address) tokens = self.nodes[0].listtokens() @@ -74,7 +74,7 @@ def run_test(self): assert tokens[0]['maxSupply'] == 1000, "incorrect max supply" assert tokens[0]['mintedNft'] == {}, "incorrect current supply" - self.nodes[0].mintnft(token['tokenId'], 1, blsct_address, {"id": "null"}) + wallet.mintnft(token['tokenId'], 1, blsct_address, {"id": "null"}) block_hashes = self.generatetoblsctaddress(self.nodes[0], 1, blsct_address) tokenInfo = self.nodes[0].gettoken(token['tokenId']) @@ -86,8 +86,8 @@ def run_test(self): self.log.info(f"Minted 1 NFT") - nft_balance = self.nodes[0].getnftbalance(token['tokenId']) - nft_balance_2 = self.nodes[1].getnftbalance(token['tokenId']) + nft_balance = wallet.getnftbalance(token['tokenId']) + nft_balance_2 = wallet_2.getnftbalance(token['tokenId']) self.log.info(f"Balance in NODE 1: {nft_balance}") self.log.info(f"Balance in NODE 2: {nft_balance_2}") @@ -97,11 +97,11 @@ def run_test(self): self.log.info(f"Sending NFT with id #1 to NODE 2") - self.nodes[0].sendnfttoblsctaddress(token['tokenId'], 1, blsct_address_2) + wallet.sendnfttoblsctaddress(token['tokenId'], 1, blsct_address_2) self.generatetoblsctaddress(self.nodes[0], 1, blsct_address) - nft_balance = self.nodes[0].getnftbalance(token['tokenId']) - nft_balance_2 = self.nodes[1].getnftbalance(token['tokenId']) + nft_balance = wallet.getnftbalance(token['tokenId']) + nft_balance_2 = wallet_2.getnftbalance(token['tokenId']) self.log.info(f"Balance in NODE 1: {nft_balance}") self.log.info(f"Balance in NODE 2: {nft_balance_2}") diff --git a/test/functional/blsct_token.py b/test/functional/blsct_token.py index e2d272af0aab5..5c7f9cbbcadc0 100755 --- a/test/functional/blsct_token.py +++ b/test/functional/blsct_token.py @@ -20,7 +20,7 @@ def set_test_params(self): def skip_test_if_missing_module(self): self.skip_if_no_wallet() - + def run_test(self): self.log.info("Creating wallet1 with BLSCT") @@ -29,8 +29,8 @@ def run_test(self): #self.init_wallet(node=0, blsct=True) self.nodes[0].createwallet(wallet_name="wallet1", blsct=True) self.nodes[1].createwallet(wallet_name="wallet1", blsct=True) - wallet_info = self.nodes[0].get_wallet_rpc("wallet1") - wallet_info_2 = self.nodes[1].get_wallet_rpc("wallet1") + wallet = self.nodes[0].get_wallet_rpc("wallet1") + wallet_2 = self.nodes[1].get_wallet_rpc("wallet1") self.log.info("Loading wallet1") @@ -41,8 +41,8 @@ def run_test(self): self.log.info("Generating BLSCT address") # Generate a BLSCT address - blsct_address = wallet_info.getnewaddress(label="", address_type="blsct") - blsct_address_2 = wallet_info_2.getnewaddress(label="", address_type="blsct") + blsct_address = wallet.getnewaddress(label="", address_type="blsct") + blsct_address_2 = wallet_2.getnewaddress(label="", address_type="blsct") self.log.info(f"BLSCT address NODE 1: {blsct_address}") self.log.info(f"BLSCT address NODE 2: {blsct_address_2}") @@ -54,14 +54,14 @@ def run_test(self): self.log.info(f"Generated blocks: {len(block_hashes)}") # Check the balance of the wallet - balance = wallet_info.getbalance() + balance = wallet.getbalance() self.log.info(f"Balance in wallet1: {balance}") assert_equal(len(block_hashes), 101) assert balance > 0, "Balance should be greater than zero after mining" self.log.info("Creating token and mining 1 block") - token = self.nodes[0].createtoken({"name": "Test"}, 1000) + token = wallet.createtoken({"name": "Test"}, 1000) block_hashes = self.generatetoblsctaddress(self.nodes[0], 1, blsct_address) tokens = self.nodes[0].listtokens() @@ -74,7 +74,7 @@ def run_test(self): assert tokens[0]['maxSupply'] == 100000000000, "incorrect max supply" assert tokens[0]['currentSupply'] == 0, "incorrect current supply" - self.nodes[0].minttoken(token['tokenId'], blsct_address, 1) + wallet.minttoken(token['tokenId'], blsct_address, 1) block_hashes = self.generatetoblsctaddress(self.nodes[0], 1, blsct_address) tokenInfo = self.nodes[0].gettoken(token['tokenId']) @@ -86,8 +86,8 @@ def run_test(self): self.log.info(f"Minted 1 token") - token_balance = self.nodes[0].gettokenbalance(token['tokenId']) - token_balance_2 = self.nodes[1].gettokenbalance(token['tokenId']) + token_balance = wallet.gettokenbalance(token['tokenId']) + token_balance_2 = wallet_2.gettokenbalance(token['tokenId']) self.log.info(f"Balance in NODE 1: {token_balance}") self.log.info(f"Balance in NODE 2: {token_balance_2}") @@ -97,11 +97,11 @@ def run_test(self): self.log.info(f"Sending 0.5 token to NODE 2") - self.nodes[0].sendtokentoblsctaddress(token['tokenId'], blsct_address_2, 0.5) + wallet.sendtokentoblsctaddress(token['tokenId'], blsct_address_2, 0.5) self.generatetoblsctaddress(self.nodes[0], 2, blsct_address) - token_balance = self.nodes[0].gettokenbalance(token['tokenId']) - token_balance_2 = self.nodes[1].gettokenbalance(token['tokenId']) + token_balance = wallet.gettokenbalance(token['tokenId']) + token_balance_2 = wallet_2.gettokenbalance(token['tokenId']) assert token_balance == 0.5, "incorrect token balance in node 1" assert token_balance_2 == 0.5, "incorrect token balance in node 2"