Merge bitcoin/bitcoin#23512: policy: Treat taproot as always active

fa3e0da06b policy: Treat taproot as always active (MarcoFalke)

Pull request description:

  Now that taproot is active, it can be treated as if it was always active for policy for the next major release. This simplifies the code and changes two things:

  * Importing `tr` descriptors can be done before the chain is fully synced. This is fine, because the wallet will already generate `tr` descriptors by default (regardless of the taproot status) after commit 47fe7445e7.
  * Valid taproot spends won't be rejected from the mempool before taproot is active. This is strictly speaking a bugfix after commit 47fe7445e7, since the wallet may generate taproot spends before the chain is fully synced. For example, a slow node or a purposefully offline node. Currently, the wallet needs the mempool to account for change. See https://github.com/bitcoin/bitcoin/issues/11887.

  A similar change was done for segwit v0 in https://github.com/bitcoin/bitcoin/pull/13120 .

  This effectively reverts commit c5ec0367d7.

ACKs for top commit:
  mjdietzx:
    Code Review ACK fa3e0da06b
  achow101:
    ACK fa3e0da06b
  sipa:
    utACK fa3e0da06b
  gruve-p:
    ACK fa3e0da06b
  gunar:
    Code Review + tACK fa3e0da06
  rajarshimaitra:
    code review + tACK fa3e0da06b

Tree-SHA512: c6dc7a4e6c345bdec33f256847dc63906ab1696aa683ab9b32a79e715613950884ac3a1a7a44e95f31bb28e58dd64679a616175f7e152b21f5550f3337c8e622
This commit is contained in:
MarcoFalke
2021-11-25 08:15:08 +01:00
13 changed files with 42 additions and 58 deletions

View File

@@ -242,20 +242,15 @@ class WalletTaprootTest(BitcoinTestFramework):
assert_equal(len(rederive), 1)
assert_equal(rederive[0], addr_g)
# tr descriptors cannot be imported when Taproot is not active
# tr descriptors can be imported regardless of Taproot status
result = self.privs_tr_enabled.importdescriptors([{"desc": desc, "timestamp": "now"}])
assert(result[0]["success"])
result = self.pubs_tr_enabled.importdescriptors([{"desc": desc_pub, "timestamp": "now"}])
assert(result[0]["success"])
if desc.startswith("tr"):
result = self.privs_tr_disabled.importdescriptors([{"desc": desc, "timestamp": "now"}])
assert(not result[0]["success"])
assert_equal(result[0]["error"]["code"], -4)
assert_equal(result[0]["error"]["message"], "Cannot import tr() descriptor when Taproot is not active")
result = self.pubs_tr_disabled.importdescriptors([{"desc": desc_pub, "timestamp": "now"}])
assert(not result[0]["success"])
assert_equal(result[0]["error"]["code"], -4)
assert_equal(result[0]["error"]["message"], "Cannot import tr() descriptor when Taproot is not active")
result = self.privs_tr_disabled.importdescriptors([{"desc": desc, "timestamp": "now"}])
assert result[0]["success"]
result = self.pubs_tr_disabled.importdescriptors([{"desc": desc_pub, "timestamp": "now"}])
assert result[0]["success"]
def do_test_sendtoaddress(self, comment, pattern, privmap, treefn, keys_pay, keys_change):
self.log.info("Testing %s through sendtoaddress" % comment)