wallet, rpc: Remove deprecated balances from getwalletinfo

This commit is contained in:
Ava Chow committed 2025-06-10 14:49:02 -07:00
1 parent 011a8c5f01
commit 0ec255139b
5 files changed
+10 -22

No files matched your search

-3
View File
@@ -170,9 +170,6 @@ class WalletTest(BitcoinTestFramework):
# getunconfirmedbalance
assert_equal(self.nodes[0].getunconfirmedbalance(), Decimal('60')) # output of node 1's spend
assert_equal(self.nodes[1].getunconfirmedbalance(), Decimal('30') - fee_node_1) # Doesn't include output of node 0's send since it was spent
# getwalletinfo.unconfirmed_balance
assert_equal(self.nodes[0].getwalletinfo()["unconfirmed_balance"], Decimal('60'))
assert_equal(self.nodes[1].getwalletinfo()["unconfirmed_balance"], Decimal('30') - fee_node_1)
test_balances(fee_node_1=Decimal('0.01'))
+4 -5
View File
@@ -69,9 +69,9 @@ class WalletTest(BitcoinTestFramework):
self.generate(self.nodes[0], 1, sync_fun=self.no_op)
walletinfo = self.nodes[0].getwalletinfo()
assert_equal(walletinfo['immature_balance'], 50)
assert_equal(walletinfo['balance'], 0)
balances = self.nodes[0].getbalances()
assert_equal(balances["mine"]["immature"], 50)
assert_equal(balances["mine"]["trusted"], 0)
self.sync_all(self.nodes[0:3])
self.generate(self.nodes[1], COINBASE_MATURITY + 1, sync_fun=lambda: self.sync_all(self.nodes[0:3]))
@@ -118,8 +118,7 @@ class WalletTest(BitcoinTestFramework):
# but 10 will go to node2 and the rest will go to node0
balance = self.nodes[0].getbalance()
assert_equal(set([txout1['value'], txout2['value']]), set([10, balance]))
walletinfo = self.nodes[0].getwalletinfo()
assert_equal(walletinfo['immature_balance'], 0)
assert_equal(self.nodes[0].getbalances()["mine"]["immature"], 0)
# Have node0 mine a block, thus it will collect its own fee.
self.generate(self.nodes[0], 1, sync_fun=lambda: self.sync_all(self.nodes[0:3]))
+2 -3
View File
@@ -185,8 +185,7 @@ class MultiWalletTest(BitcoinTestFramework):
self.nodes[0].loadwallet("w5")
assert_equal(set(node.listwallets()), {"w4", "w5"})
w5 = wallet("w5")
w5_info = w5.getwalletinfo()
assert_equal(w5_info['immature_balance'], 50)
assert_equal(w5.getbalances()["mine"]["immature"], 50)
competing_wallet_dir = os.path.join(self.options.tmpdir, 'competing_walletdir')
os.mkdir(competing_wallet_dir)
@@ -208,7 +207,7 @@ class MultiWalletTest(BitcoinTestFramework):
self.generatetoaddress(node, nblocks=1, address=wallets[0].getnewaddress(), sync_fun=self.no_op)
for wallet_name, wallet in zip(wallet_names, wallets):
info = wallet.getwalletinfo()
assert_equal(info['immature_balance'], 50 if wallet is wallets[0] else 0)
assert_equal(wallet.getbalances()["mine"]["immature"], 50 if wallet is wallets[0] else 0)
assert_equal(info['walletname'], wallet_name)
# accessing invalid wallet fails
+4 -4
View File
@@ -100,7 +100,7 @@ class ReorgsRestoreTest(BitcoinTestFramework):
# Restart to ensure node and wallet are flushed
self.restart_node(0)
wallet = node.get_wallet_rpc("reorg_crash")
assert_greater_than(wallet.getwalletinfo()['immature_balance'], 0)
assert_greater_than(wallet.getbalances()["mine"]["immature"], 0)
# Disconnect tip and sync wallet state
tip = wallet.getbestblockhash()
@@ -108,7 +108,7 @@ class ReorgsRestoreTest(BitcoinTestFramework):
wallet.syncwithvalidationinterfacequeue()
# Tip was disconnected, ensure coinbase has been abandoned
assert_equal(wallet.getwalletinfo()['immature_balance'], 0)
assert_equal(wallet.getbalances()["mine"]["immature"], 0)
coinbase_tx_id = wallet.getblock(tip, verbose=1)["tx"][0]
assert_equal(wallet.gettransaction(coinbase_tx_id)['details'][0]['abandoned'], True)
@@ -131,12 +131,12 @@ class ReorgsRestoreTest(BitcoinTestFramework):
assert(node.getbestblockhash() != tip)
# Ensure wallet state is consistent now
assert_equal(wallet.gettransaction(coinbase_tx_id)['details'][0]['abandoned'], True)
assert_equal(wallet.getwalletinfo()['immature_balance'], 0)
assert_equal(wallet.getbalances()["mine"]["immature"], 0)
# And finally, verify the state if the block ends up being into the best chain again
node.reconsiderblock(tip)
assert_equal(wallet.gettransaction(coinbase_tx_id)['details'][0]['abandoned'], False)
assert_greater_than(wallet.getwalletinfo()['immature_balance'], 0)
assert_greater_than(wallet.getbalances()["mine"]["immature"], 0)
def run_test(self):
# Send a tx from which to conflict outputs later