mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-06-29 02:11:24 +02:00
Merge #14296: [wallet] Remove addwitnessaddress
2b91e42ece
[docs] Add release note for removing getwitnessaddress (John Newbery)ebec90ac97
[wallet] Remove deprecated addwitnessaddress RPC method (John Newbery)07e3f585ab
[test] Remove deprecated addwitnessaddress from feature_segwit.py (John Newbery)82f2fa03a5
[test] Remove deprecated addwitnessaddress from wallet_bumpfee.py (John Newbery)9d7ee187a3
[test] Remove deprecated addwitnessaddress from p2p_compactblocks.py (John Newbery)3cf77f0b3e
[tests] Remove deprecated addwitnessaddress call from wallet_dump.py (John Newbery)bdefc9705d
[tests] Remove deprecated addwitnessaddress call from feature_nulldummy (John Newbery)67d7d67cf3
[test] Fix flake8 warnings in tests (John Newbery) Pull request description: Fully removes the `addwitnessaddress` RPC method, which was deprecated in V0.17 Tree-SHA512: 8fa8a2a721a81262fbdedbe1cef031e6a07aa6abbc9760dbc62738fc4f688b44bd737d0f3cdb1aec046866a6395befbfecde0f34e76a99e11d3cf566cad1d0de
This commit is contained in:
@ -7,7 +7,6 @@
|
||||
Version 1 compact blocks are pre-segwit (txids)
|
||||
Version 2 compact blocks are post-segwit (wtxids)
|
||||
"""
|
||||
|
||||
from decimal import Decimal
|
||||
import random
|
||||
|
||||
@ -99,7 +98,7 @@ class CompactBlocksTest(BitcoinTestFramework):
|
||||
self.num_nodes = 2
|
||||
# This test was written assuming SegWit is activated using BIP9 at height 432 (3x confirmation window).
|
||||
# TODO: Rewrite this test to support SegWit being always active.
|
||||
self.extra_args = [["-vbparams=segwit:0:0"], ["-vbparams=segwit:0:999999999999", "-txindex", "-deprecatedrpc=addwitnessaddress"]]
|
||||
self.extra_args = [["-vbparams=segwit:0:0"], ["-vbparams=segwit:0:999999999999", "-txindex"]]
|
||||
self.utxos = []
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
@ -189,7 +188,7 @@ class CompactBlocksTest(BitcoinTestFramework):
|
||||
|
||||
# Now try a SENDCMPCT message with too-high version
|
||||
sendcmpct = msg_sendcmpct()
|
||||
sendcmpct.version = preferred_version+1
|
||||
sendcmpct.version = preferred_version + 1
|
||||
sendcmpct.announce = True
|
||||
test_node.send_and_ping(sendcmpct)
|
||||
check_announcement_of_new_block(node, test_node, lambda p: "cmpctblock" not in p.last_message)
|
||||
@ -220,7 +219,7 @@ class CompactBlocksTest(BitcoinTestFramework):
|
||||
check_announcement_of_new_block(node, test_node, lambda p: "cmpctblock" in p.last_message)
|
||||
|
||||
# Try one more time, after sending a version-1, announce=false message.
|
||||
sendcmpct.version = preferred_version-1
|
||||
sendcmpct.version = preferred_version - 1
|
||||
sendcmpct.announce = False
|
||||
test_node.send_and_ping(sendcmpct)
|
||||
check_announcement_of_new_block(node, test_node, lambda p: "cmpctblock" in p.last_message)
|
||||
@ -234,7 +233,7 @@ class CompactBlocksTest(BitcoinTestFramework):
|
||||
if old_node is not None:
|
||||
# Verify that a peer using an older protocol version can receive
|
||||
# announcements from this node.
|
||||
sendcmpct.version = preferred_version-1
|
||||
sendcmpct.version = preferred_version - 1
|
||||
sendcmpct.announce = True
|
||||
old_node.send_and_ping(sendcmpct)
|
||||
# Header sync
|
||||
@ -265,9 +264,9 @@ class CompactBlocksTest(BitcoinTestFramework):
|
||||
if use_witness_address:
|
||||
# Want at least one segwit spend, so move all funds to
|
||||
# a witness address.
|
||||
address = node.addwitnessaddress(address)
|
||||
address = node.getnewaddress(address_type='bech32')
|
||||
value_to_send = node.getbalance()
|
||||
node.sendtoaddress(address, satoshi_round(value_to_send-Decimal(0.1)))
|
||||
node.sendtoaddress(address, satoshi_round(value_to_send - Decimal(0.1)))
|
||||
node.generate(1)
|
||||
|
||||
segwit_tx_generated = False
|
||||
@ -279,7 +278,7 @@ class CompactBlocksTest(BitcoinTestFramework):
|
||||
segwit_tx_generated = True
|
||||
|
||||
if use_witness_address:
|
||||
assert(segwit_tx_generated) # check that our test is not broken
|
||||
assert segwit_tx_generated # check that our test is not broken
|
||||
|
||||
# Wait until we've seen the block announcement for the resulting tip
|
||||
tip = int(node.getbestblockhash(), 16)
|
||||
@ -403,8 +402,7 @@ class CompactBlocksTest(BitcoinTestFramework):
|
||||
coinbase_hash = block.vtx[0].sha256
|
||||
if version == 2:
|
||||
coinbase_hash = block.vtx[0].calc_sha256(True)
|
||||
comp_block.shortids = [
|
||||
calculate_shortid(k0, k1, coinbase_hash) ]
|
||||
comp_block.shortids = [calculate_shortid(k0, k1, coinbase_hash)]
|
||||
test_node.send_and_ping(msg_cmpctblock(comp_block.to_p2p()))
|
||||
assert_equal(int(node.getbestblockhash(), 16), block.hashPrevBlock)
|
||||
# Expect a getblocktxn message.
|
||||
@ -443,7 +441,7 @@ class CompactBlocksTest(BitcoinTestFramework):
|
||||
# node needs, and that responding to them causes the block to be
|
||||
# reconstructed.
|
||||
def test_getblocktxn_requests(self, node, test_node, version):
|
||||
with_witness = (version==2)
|
||||
with_witness = (version == 2)
|
||||
|
||||
def test_getblocktxn_response(compact_block, peer, expected_result):
|
||||
msg = msg_cmpctblock(compact_block.to_p2p())
|
||||
@ -470,7 +468,7 @@ class CompactBlocksTest(BitcoinTestFramework):
|
||||
|
||||
msg_bt = msg_blocktxn()
|
||||
if with_witness:
|
||||
msg_bt = msg_witness_blocktxn() # serialize with witnesses
|
||||
msg_bt = msg_witness_blocktxn() # serialize with witnesses
|
||||
msg_bt.block_transactions = BlockTransactions(block.sha256, block.vtx[1:])
|
||||
test_tip_after_message(node, test_node, msg_bt, block.sha256)
|
||||
|
||||
@ -560,7 +558,7 @@ class CompactBlocksTest(BitcoinTestFramework):
|
||||
# verifying that the block isn't marked bad permanently. This is good
|
||||
# enough for now.
|
||||
msg = msg_blocktxn()
|
||||
if version==2:
|
||||
if version == 2:
|
||||
msg = msg_witness_blocktxn()
|
||||
msg.block_transactions = BlockTransactions(block.sha256, [block.vtx[5]] + block.vtx[7:])
|
||||
test_node.send_and_ping(msg)
|
||||
@ -571,11 +569,11 @@ class CompactBlocksTest(BitcoinTestFramework):
|
||||
# We should receive a getdata request
|
||||
wait_until(lambda: "getdata" in test_node.last_message, timeout=10, lock=mininode_lock)
|
||||
assert_equal(len(test_node.last_message["getdata"].inv), 1)
|
||||
assert(test_node.last_message["getdata"].inv[0].type == 2 or test_node.last_message["getdata"].inv[0].type == 2|MSG_WITNESS_FLAG)
|
||||
assert(test_node.last_message["getdata"].inv[0].type == 2 or test_node.last_message["getdata"].inv[0].type == 2 | MSG_WITNESS_FLAG)
|
||||
assert_equal(test_node.last_message["getdata"].inv[0].hash, block.sha256)
|
||||
|
||||
# Deliver the block
|
||||
if version==2:
|
||||
if version == 2:
|
||||
test_node.send_and_ping(msg_witness_block(block))
|
||||
else:
|
||||
test_node.send_and_ping(msg_block(block))
|
||||
@ -655,7 +653,7 @@ class CompactBlocksTest(BitcoinTestFramework):
|
||||
|
||||
# Generate an old compactblock, and verify that it's not accepted.
|
||||
cur_height = node.getblockcount()
|
||||
hashPrevBlock = int(node.getblockhash(cur_height-5), 16)
|
||||
hashPrevBlock = int(node.getblockhash(cur_height - 5), 16)
|
||||
block = self.build_block_on_tip(node)
|
||||
block.hashPrevBlock = hashPrevBlock
|
||||
block.solve()
|
||||
@ -684,7 +682,7 @@ class CompactBlocksTest(BitcoinTestFramework):
|
||||
assert "blocktxn" not in test_node.last_message
|
||||
|
||||
def activate_segwit(self, node):
|
||||
node.generate(144*3)
|
||||
node.generate(144 * 3)
|
||||
assert_equal(get_bip9_status(node, "segwit")["status"], 'active')
|
||||
|
||||
def test_end_to_end_block_relay(self, node, listeners):
|
||||
@ -780,7 +778,7 @@ class CompactBlocksTest(BitcoinTestFramework):
|
||||
delivery_peer.send_message(msg_tx(tx))
|
||||
delivery_peer.sync_with_ping()
|
||||
|
||||
cmpct_block.prefilled_txn[0].tx.wit.vtxinwit = [ CTxInWitness() ]
|
||||
cmpct_block.prefilled_txn[0].tx.wit.vtxinwit = [CTxInWitness()]
|
||||
cmpct_block.prefilled_txn[0].tx.wit.vtxinwit[0].scriptWitness.stack = [ser_uint256(0)]
|
||||
|
||||
cmpct_block.use_witness = True
|
||||
@ -886,7 +884,7 @@ class CompactBlocksTest(BitcoinTestFramework):
|
||||
self.log.info("Syncing nodes...")
|
||||
assert(self.nodes[0].getbestblockhash() != self.nodes[1].getbestblockhash())
|
||||
while (self.nodes[0].getblockcount() > self.nodes[1].getblockcount()):
|
||||
block_hash = self.nodes[0].getblockhash(self.nodes[1].getblockcount()+1)
|
||||
block_hash = self.nodes[0].getblockhash(self.nodes[1].getblockcount() + 1)
|
||||
self.nodes[1].submitblock(self.nodes[0].getblock(block_hash, False))
|
||||
assert_equal(self.nodes[0].getbestblockhash(), self.nodes[1].getbestblockhash())
|
||||
|
||||
|
Reference in New Issue
Block a user