-
Notifications
You must be signed in to change notification settings - Fork 38.7k
[29.x] backports + final changes for 29.3 #34268
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 29.x
Are you sure you want to change the base?
Conversation
Github-Pull: bitcoin#33475 Rebased-From: b807dfc
Github-Pull: bitcoin#33723 Rebased-From: b0c7067
Github-Pull: bitcoin#34227 Rebased-From: 194114d
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. Code Coverage & BenchmarksFor details see: https://corecheck.dev/bitcoin/bitcoin/pulls/34268. ReviewsSee the guideline for information on the review process. |
689fccc to
00a8f41
Compare
00a8f41 to
b7ae655
Compare
achow101
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| if self.options.descriptors: | ||
| self.test_from_me_status_change() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In f70a3dd "test: Test wallet 'from me' status change"
Instead of disabling this test for legacy wallets, the following diff can adapt it to be usable for both wallet types:
diff --git a/test/functional/wallet_listtransactions.py b/test/functional/wallet_listtransactions.py
index 5c2cfbf85d1..6a76bcc5e7c 100755
--- a/test/functional/wallet_listtransactions.py
+++ b/test/functional/wallet_listtransactions.py
@@ -119,8 +119,7 @@ class ListTransactionsTest(BitcoinTestFramework):
self.run_invalid_parameters_test()
self.test_op_return()
- if self.options.descriptors:
- self.test_from_me_status_change()
+ self.test_from_me_status_change()
def run_rbf_opt_in_test(self):
"""Test the opt-in-rbf flag for sent and received transactions."""
@@ -345,8 +344,7 @@ class ListTransactionsTest(BitcoinTestFramework):
# Run twice, once for a transaction in the mempool, again when it confirms
for confirm in [False, True]:
key = get_generate_key()
- descriptor = descsum_create(f"wpkh({key.privkey})")
- default_wallet.importdescriptors([{"desc": descriptor, "timestamp": "now"}])
+ default_wallet.importprivkey(key.privkey)
send_res = default_wallet.send(outputs=[{key.p2wpkh_addr: 1}, {wallet.getnewaddress(): 1}])
assert_equal(send_res["complete"], True)
@@ -370,8 +368,7 @@ class ListTransactionsTest(BitcoinTestFramework):
self.nodes[0].setmocktime(int(time.time()) + MAX_FUTURE_BLOCK_TIME + 1)
self.generate(self.nodes[0], 10, sync_fun=self.no_op)
- import_res = wallet.importdescriptors([{"desc": descriptor, "timestamp": "now"}])
- assert_equal(import_res[0]["success"], True)
+ wallet.importprivkey(key.privkey)
# TODO: We should check that the fee matches, but since the transaction spends inputs
# not known to the wallet, it is incorrectly calculating the fee.
# assert_equal(wallet.gettransaction(txid)["fee"], fee)| if self.options.descriptors: | ||
| import_res = wallet.importdescriptors([{"desc": descsum_create(f"addr({ANCHOR_ADDRESS})"), "timestamp": "now"}]) | ||
| assert_equal(import_res[0]["success"], True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In b605cc8 "test: Add a test for anchor outputs in the wallet"
Using wallet.importaddress(ANCHOR_ADDRESS, rescan=False) instead of importdescriptors here allows this test case to work for both descriptors and legacy wallets.
test/functional/wallet_anchor.py
Outdated
| if self.options.descriptors: | ||
| self.test_cannot_sign_anchors() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In b605cc8 "test: Add a test for anchor outputs in the wallet"
The following diff allows this test to work for both descriptors and legacy wallets
diff --git a/test/functional/wallet_anchor.py b/test/functional/wallet_anchor.py
index 49ec75928c0..0b08986d00d 100755
--- a/test/functional/wallet_anchor.py
+++ b/test/functional/wallet_anchor.py
@@ -92,12 +92,15 @@ class WalletAnchorTest(BitcoinTestFramework):
for disable_privkeys in [False, True]:
self.nodes[0].createwallet(wallet_name=f"anchor_spend_{disable_privkeys}", disable_private_keys=disable_privkeys)
wallet = self.nodes[0].get_wallet_rpc(f"anchor_spend_{disable_privkeys}")
- import_res = wallet.importdescriptors([
- {"desc": descsum_create(f"addr({ANCHOR_ADDRESS})"), "timestamp": "now"},
- {"desc": descsum_create(f"raw({PAY_TO_ANCHOR.hex()})"), "timestamp": "now"}
- ])
- assert_equal(import_res[0]["success"], disable_privkeys)
- assert_equal(import_res[1]["success"], disable_privkeys)
+ if self.options.descriptors:
+ import_res = wallet.importdescriptors([
+ {"desc": descsum_create(f"addr({ANCHOR_ADDRESS})"), "timestamp": "now"},
+ {"desc": descsum_create(f"raw({PAY_TO_ANCHOR.hex()})"), "timestamp": "now"}
+ ])
+ assert_equal(import_res[0]["success"], disable_privkeys)
+ assert_equal(import_res[1]["success"], disable_privkeys)
+ else:
+ wallet.importaddress(ANCHOR_ADDRESS)
anchor_txid = self.default_wallet.sendtoaddress(ANCHOR_ADDRESS, 1)
self.generate(self.nodes[0], 1)
@@ -109,16 +112,19 @@ class WalletAnchorTest(BitcoinTestFramework):
assert_equal(utxos[0]["address"], ANCHOR_ADDRESS)
assert_equal(utxos[0]["amount"], 1)
- assert_raises_rpc_error(-4, "Missing solving data for estimating transaction size", wallet.send, [{self.default_wallet.getnewaddress(): 0.9999}])
+ if self.options.descriptors:
+ assert_raises_rpc_error(-4, "Missing solving data for estimating transaction size", wallet.send, [{self.default_wallet.getnewaddress(): 0.9999}])
+ assert_raises_rpc_error(-4, "Unable to determine the size of the transaction, the wallet contains unsolvable descriptors", wallet.sendall, recipients=[self.default_wallet.getnewaddress()])
+ else:
+ assert_raises_rpc_error(-4, "Insufficient funds", wallet.send, [{self.default_wallet.getnewaddress(): 0.9999}])
+ assert_raises_rpc_error(-6, "Total value of UTXO pool too low to pay for transaction. Try using lower feerate or excluding uneconomic UTXOs with 'send_max' option.", wallet.sendall, recipients=[self.default_wallet.getnewaddress()])
assert_raises_rpc_error(-4, "Error: Private keys are disabled for this wallet", wallet.sendtoaddress, self.default_wallet.getnewaddress(), 0.9999)
assert_raises_rpc_error(-4, "Unable to determine the size of the transaction, the wallet contains unsolvable descriptors", wallet.sendall, recipients=[self.default_wallet.getnewaddress()], inputs=utxos)
- assert_raises_rpc_error(-4, "Unable to determine the size of the transaction, the wallet contains unsolvable descriptors", wallet.sendall, recipients=[self.default_wallet.getnewaddress()])
def run_test(self):
self.default_wallet = self.nodes[0].get_wallet_rpc(self.default_wallet_name)
self.test_0_value_anchor_listunspent()
- if self.options.descriptors:
- self.test_cannot_sign_anchors()
+ self.test_cannot_sign_anchors()
if __name__ == '__main__':
WalletAnchorTest(__file__).main()b7ae655 to
55fd7b9
Compare
If something is imported into the wallet, it can change the 'from me' status of a transaction. This status is only visible through gettransaction's "fee" field which is only shown for transactions that are 'from me'. Github-Pull: bitcoin#33268 Rebased-From: e76c2f7
Instead of checking whether the total amount of inputs known by the wallet is greater than 0, we should be checking for whether the input is known by the wallet. This enables us to determine whether a transaction spends an of output with an amount of 0, which is necessary for marking 0-value dust outputs as spent. Github-Pull: bitcoin#33268 Rebased-From: 39a7dbd
Github-Pull: bitcoin#33268 Rebased-From: c40dc82
Github-Pull: bitcoin#33268 Rebased-From: 609d265
55fd7b9 to
794f666
Compare
Backports:
osslsigncodetests #34227addPackageTxsunsigned integer overflow #33475And final changes for 29.3rc1