mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-19 05:45:05 +01:00
scripted-diff: [test] Rename BIP125_SEQUENCE_NUMBER to MAX_BIP125_RBF_SEQUENCE
-BEGIN VERIFY SCRIPT- sed -i 's:BIP125_SEQUENCE_NUMBER:MAX_BIP125_RBF_SEQUENCE:g' $(git grep -l BIP125_SEQUENCE_NUMBER ./test) -END VERIFY SCRIPT-
This commit is contained in:
parent
1d89fc695a
commit
fa0404dbb7
@ -7,7 +7,7 @@
|
|||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
|
|
||||||
from test_framework.messages import (
|
from test_framework.messages import (
|
||||||
BIP125_SEQUENCE_NUMBER,
|
MAX_BIP125_RBF_SEQUENCE,
|
||||||
COIN,
|
COIN,
|
||||||
SEQUENCE_FINAL,
|
SEQUENCE_FINAL,
|
||||||
)
|
)
|
||||||
@ -428,7 +428,7 @@ class ReplaceByFeeTest(BitcoinTestFramework):
|
|||||||
|
|
||||||
optin_parent_tx = wallet.send_self_transfer_multi(
|
optin_parent_tx = wallet.send_self_transfer_multi(
|
||||||
from_node=normal_node,
|
from_node=normal_node,
|
||||||
sequence=BIP125_SEQUENCE_NUMBER,
|
sequence=MAX_BIP125_RBF_SEQUENCE,
|
||||||
utxos_to_spend=[root_utxos[graph_num]],
|
utxos_to_spend=[root_utxos[graph_num]],
|
||||||
num_outputs=txs_per_graph,
|
num_outputs=txs_per_graph,
|
||||||
)
|
)
|
||||||
@ -636,14 +636,14 @@ class ReplaceByFeeTest(BitcoinTestFramework):
|
|||||||
optin_parent_tx = self.wallet.send_self_transfer(
|
optin_parent_tx = self.wallet.send_self_transfer(
|
||||||
from_node=self.nodes[0],
|
from_node=self.nodes[0],
|
||||||
utxo_to_spend=confirmed_utxo,
|
utxo_to_spend=confirmed_utxo,
|
||||||
sequence=BIP125_SEQUENCE_NUMBER,
|
sequence=MAX_BIP125_RBF_SEQUENCE,
|
||||||
fee_rate=Decimal('0.01'),
|
fee_rate=Decimal('0.01'),
|
||||||
)
|
)
|
||||||
assert_equal(True, self.nodes[0].getmempoolentry(optin_parent_tx['txid'])['bip125-replaceable'])
|
assert_equal(True, self.nodes[0].getmempoolentry(optin_parent_tx['txid'])['bip125-replaceable'])
|
||||||
|
|
||||||
replacement_parent_tx = self.wallet.create_self_transfer(
|
replacement_parent_tx = self.wallet.create_self_transfer(
|
||||||
utxo_to_spend=confirmed_utxo,
|
utxo_to_spend=confirmed_utxo,
|
||||||
sequence=BIP125_SEQUENCE_NUMBER,
|
sequence=MAX_BIP125_RBF_SEQUENCE,
|
||||||
fee_rate=Decimal('0.02'),
|
fee_rate=Decimal('0.02'),
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -711,7 +711,7 @@ class ReplaceByFeeTest(BitcoinTestFramework):
|
|||||||
optout_tx = self.wallet.send_self_transfer(
|
optout_tx = self.wallet.send_self_transfer(
|
||||||
from_node=self.nodes[0],
|
from_node=self.nodes[0],
|
||||||
utxo_to_spend=confirmed_utxo,
|
utxo_to_spend=confirmed_utxo,
|
||||||
sequence=BIP125_SEQUENCE_NUMBER + 1,
|
sequence=MAX_BIP125_RBF_SEQUENCE + 1,
|
||||||
fee_rate=Decimal('0.01'),
|
fee_rate=Decimal('0.01'),
|
||||||
)
|
)
|
||||||
assert_equal(False, self.nodes[0].getmempoolentry(optout_tx['txid'])['bip125-replaceable'])
|
assert_equal(False, self.nodes[0].getmempoolentry(optout_tx['txid'])['bip125-replaceable'])
|
||||||
|
@ -11,7 +11,7 @@ import math
|
|||||||
from test_framework.test_framework import BitcoinTestFramework
|
from test_framework.test_framework import BitcoinTestFramework
|
||||||
from test_framework.key import ECKey
|
from test_framework.key import ECKey
|
||||||
from test_framework.messages import (
|
from test_framework.messages import (
|
||||||
BIP125_SEQUENCE_NUMBER,
|
MAX_BIP125_RBF_SEQUENCE,
|
||||||
COIN,
|
COIN,
|
||||||
COutPoint,
|
COutPoint,
|
||||||
CTxIn,
|
CTxIn,
|
||||||
@ -87,7 +87,7 @@ class MempoolAcceptanceTest(BitcoinTestFramework):
|
|||||||
self.log.info('A transaction not in the mempool')
|
self.log.info('A transaction not in the mempool')
|
||||||
fee = Decimal('0.000007')
|
fee = Decimal('0.000007')
|
||||||
utxo_to_spend = self.wallet.get_utxo(txid=txid_in_block) # use 0.3 BTC UTXO
|
utxo_to_spend = self.wallet.get_utxo(txid=txid_in_block) # use 0.3 BTC UTXO
|
||||||
tx = self.wallet.create_self_transfer(utxo_to_spend=utxo_to_spend, sequence=BIP125_SEQUENCE_NUMBER)['tx']
|
tx = self.wallet.create_self_transfer(utxo_to_spend=utxo_to_spend, sequence=MAX_BIP125_RBF_SEQUENCE)['tx']
|
||||||
tx.vout[0].nValue = int((Decimal('0.3') - fee) * COIN)
|
tx.vout[0].nValue = int((Decimal('0.3') - fee) * COIN)
|
||||||
raw_tx_0 = tx.serialize().hex()
|
raw_tx_0 = tx.serialize().hex()
|
||||||
txid_0 = tx.rehash()
|
txid_0 = tx.rehash()
|
||||||
@ -125,7 +125,7 @@ class MempoolAcceptanceTest(BitcoinTestFramework):
|
|||||||
self.log.info('A transaction that replaces a mempool transaction')
|
self.log.info('A transaction that replaces a mempool transaction')
|
||||||
tx = tx_from_hex(raw_tx_0)
|
tx = tx_from_hex(raw_tx_0)
|
||||||
tx.vout[0].nValue -= int(fee * COIN) # Double the fee
|
tx.vout[0].nValue -= int(fee * COIN) # Double the fee
|
||||||
tx.vin[0].nSequence = BIP125_SEQUENCE_NUMBER + 1 # Now, opt out of RBF
|
tx.vin[0].nSequence = MAX_BIP125_RBF_SEQUENCE + 1 # Now, opt out of RBF
|
||||||
raw_tx_0 = tx.serialize().hex()
|
raw_tx_0 = tx.serialize().hex()
|
||||||
txid_0 = tx.rehash()
|
txid_0 = tx.rehash()
|
||||||
self.check_mempool_result(
|
self.check_mempool_result(
|
||||||
|
@ -16,7 +16,7 @@ from test_framework.blocktools import (
|
|||||||
)
|
)
|
||||||
from test_framework.key import ECKey
|
from test_framework.key import ECKey
|
||||||
from test_framework.messages import (
|
from test_framework.messages import (
|
||||||
BIP125_SEQUENCE_NUMBER,
|
MAX_BIP125_RBF_SEQUENCE,
|
||||||
CBlockHeader,
|
CBlockHeader,
|
||||||
CInv,
|
CInv,
|
||||||
COutPoint,
|
COutPoint,
|
||||||
@ -589,7 +589,7 @@ class SegWitTest(BitcoinTestFramework):
|
|||||||
tx.vin = [CTxIn(COutPoint(p2sh_tx.sha256, 0), CScript([witness_script]))]
|
tx.vin = [CTxIn(COutPoint(p2sh_tx.sha256, 0), CScript([witness_script]))]
|
||||||
tx.vout = [CTxOut(p2sh_tx.vout[0].nValue - 10000, script_pubkey)]
|
tx.vout = [CTxOut(p2sh_tx.vout[0].nValue - 10000, script_pubkey)]
|
||||||
tx.vout.append(CTxOut(8000, script_pubkey)) # Might burn this later
|
tx.vout.append(CTxOut(8000, script_pubkey)) # Might burn this later
|
||||||
tx.vin[0].nSequence = BIP125_SEQUENCE_NUMBER # Just to have the option to bump this tx from the mempool
|
tx.vin[0].nSequence = MAX_BIP125_RBF_SEQUENCE # Just to have the option to bump this tx from the mempool
|
||||||
tx.rehash()
|
tx.rehash()
|
||||||
|
|
||||||
# This is always accepted, since the mempool policy is to consider segwit as always active
|
# This is always accepted, since the mempool policy is to consider segwit as always active
|
||||||
|
@ -10,7 +10,7 @@ import random
|
|||||||
from test_framework.address import ADDRESS_BCRT1_P2WSH_OP_TRUE
|
from test_framework.address import ADDRESS_BCRT1_P2WSH_OP_TRUE
|
||||||
from test_framework.test_framework import BitcoinTestFramework
|
from test_framework.test_framework import BitcoinTestFramework
|
||||||
from test_framework.messages import (
|
from test_framework.messages import (
|
||||||
BIP125_SEQUENCE_NUMBER,
|
MAX_BIP125_RBF_SEQUENCE,
|
||||||
COIN,
|
COIN,
|
||||||
CTxInWitness,
|
CTxInWitness,
|
||||||
tx_from_hex,
|
tx_from_hex,
|
||||||
@ -273,7 +273,7 @@ class RPCPackagesTest(BitcoinTestFramework):
|
|||||||
def test_rbf(self):
|
def test_rbf(self):
|
||||||
node = self.nodes[0]
|
node = self.nodes[0]
|
||||||
coin = self.coins.pop()
|
coin = self.coins.pop()
|
||||||
inputs = [{"txid": coin["txid"], "vout": 0, "sequence": BIP125_SEQUENCE_NUMBER}]
|
inputs = [{"txid": coin["txid"], "vout": 0, "sequence": MAX_BIP125_RBF_SEQUENCE}]
|
||||||
fee = Decimal('0.00125000')
|
fee = Decimal('0.00125000')
|
||||||
output = {node.get_deterministic_priv_key().address: 50 - fee}
|
output = {node.get_deterministic_priv_key().address: 50 - fee}
|
||||||
raw_replaceable_tx = node.createrawtransaction(inputs, output)
|
raw_replaceable_tx = node.createrawtransaction(inputs, output)
|
||||||
|
@ -17,7 +17,7 @@ from decimal import Decimal
|
|||||||
|
|
||||||
from test_framework.blocktools import COINBASE_MATURITY
|
from test_framework.blocktools import COINBASE_MATURITY
|
||||||
from test_framework.messages import (
|
from test_framework.messages import (
|
||||||
BIP125_SEQUENCE_NUMBER,
|
MAX_BIP125_RBF_SEQUENCE,
|
||||||
CTransaction,
|
CTransaction,
|
||||||
tx_from_hex,
|
tx_from_hex,
|
||||||
)
|
)
|
||||||
@ -223,7 +223,7 @@ class RawTransactionsTest(BitcoinTestFramework):
|
|||||||
|
|
||||||
# Test `createrawtransaction` mismatch between sequence number(s) and `replaceable` option
|
# Test `createrawtransaction` mismatch between sequence number(s) and `replaceable` option
|
||||||
assert_raises_rpc_error(-8, "Invalid parameter combination: Sequence number(s) contradict replaceable option",
|
assert_raises_rpc_error(-8, "Invalid parameter combination: Sequence number(s) contradict replaceable option",
|
||||||
self.nodes[0].createrawtransaction, [{'txid': TXID, 'vout': 0, 'sequence': BIP125_SEQUENCE_NUMBER+1}], {}, 0, True)
|
self.nodes[0].createrawtransaction, [{'txid': TXID, 'vout': 0, 'sequence': MAX_BIP125_RBF_SEQUENCE+1}], {}, 0, True)
|
||||||
|
|
||||||
# Test `createrawtransaction` invalid `locktime`
|
# Test `createrawtransaction` invalid `locktime`
|
||||||
assert_raises_rpc_error(-3, "Expected type number", self.nodes[0].createrawtransaction, [], {}, 'foo')
|
assert_raises_rpc_error(-3, "Expected type number", self.nodes[0].createrawtransaction, [], {}, 'foo')
|
||||||
|
@ -39,7 +39,7 @@ MAX_BLOOM_HASH_FUNCS = 50
|
|||||||
COIN = 100000000 # 1 btc in satoshis
|
COIN = 100000000 # 1 btc in satoshis
|
||||||
MAX_MONEY = 21000000 * COIN
|
MAX_MONEY = 21000000 * COIN
|
||||||
|
|
||||||
BIP125_SEQUENCE_NUMBER = 0xfffffffd # Sequence number that is rbf-opt-in (BIP 125) and csv-opt-out (BIP 68)
|
MAX_BIP125_RBF_SEQUENCE = 0xfffffffd # Sequence number that is rbf-opt-in (BIP 125) and csv-opt-out (BIP 68)
|
||||||
SEQUENCE_FINAL = 0xffffffff # Sequence number that disables nLockTime if set for every input of a tx
|
SEQUENCE_FINAL = 0xffffffff # Sequence number that disables nLockTime if set for every input of a tx
|
||||||
|
|
||||||
MAX_PROTOCOL_MESSAGE_LENGTH = 4000000 # Maximum length of incoming protocol messages
|
MAX_PROTOCOL_MESSAGE_LENGTH = 4000000 # Maximum length of incoming protocol messages
|
||||||
|
@ -23,7 +23,7 @@ from test_framework.blocktools import (
|
|||||||
send_to_witness,
|
send_to_witness,
|
||||||
)
|
)
|
||||||
from test_framework.messages import (
|
from test_framework.messages import (
|
||||||
BIP125_SEQUENCE_NUMBER,
|
MAX_BIP125_RBF_SEQUENCE,
|
||||||
)
|
)
|
||||||
from test_framework.test_framework import BitcoinTestFramework
|
from test_framework.test_framework import BitcoinTestFramework
|
||||||
from test_framework.util import (
|
from test_framework.util import (
|
||||||
@ -212,7 +212,7 @@ def test_segwit_bumpfee_succeeds(self, rbf_node, dest_address):
|
|||||||
rbfraw = rbf_node.createrawtransaction([{
|
rbfraw = rbf_node.createrawtransaction([{
|
||||||
'txid': segwitid,
|
'txid': segwitid,
|
||||||
'vout': 0,
|
'vout': 0,
|
||||||
"sequence": BIP125_SEQUENCE_NUMBER
|
"sequence": MAX_BIP125_RBF_SEQUENCE
|
||||||
}], {dest_address: Decimal("0.0005"),
|
}], {dest_address: Decimal("0.0005"),
|
||||||
rbf_node.getrawchangeaddress(): Decimal("0.0003")})
|
rbf_node.getrawchangeaddress(): Decimal("0.0003")})
|
||||||
rbfsigned = rbf_node.signrawtransactionwithwallet(rbfraw)
|
rbfsigned = rbf_node.signrawtransactionwithwallet(rbfraw)
|
||||||
@ -243,7 +243,7 @@ def test_notmine_bumpfee_fails(self, rbf_node, peer_node, dest_address):
|
|||||||
"txid": utxo["txid"],
|
"txid": utxo["txid"],
|
||||||
"vout": utxo["vout"],
|
"vout": utxo["vout"],
|
||||||
"address": utxo["address"],
|
"address": utxo["address"],
|
||||||
"sequence": BIP125_SEQUENCE_NUMBER
|
"sequence": MAX_BIP125_RBF_SEQUENCE
|
||||||
} for utxo in utxos]
|
} for utxo in utxos]
|
||||||
output_val = sum(utxo["amount"] for utxo in utxos) - fee
|
output_val = sum(utxo["amount"] for utxo in utxos) - fee
|
||||||
rawtx = rbf_node.createrawtransaction(inputs, {dest_address: output_val})
|
rawtx = rbf_node.createrawtransaction(inputs, {dest_address: output_val})
|
||||||
@ -578,7 +578,7 @@ def test_change_script_match(self, rbf_node, dest_address):
|
|||||||
|
|
||||||
def spend_one_input(node, dest_address, change_size=Decimal("0.00049000")):
|
def spend_one_input(node, dest_address, change_size=Decimal("0.00049000")):
|
||||||
tx_input = dict(
|
tx_input = dict(
|
||||||
sequence=BIP125_SEQUENCE_NUMBER, **next(u for u in node.listunspent() if u["amount"] == Decimal("0.00100000")))
|
sequence=MAX_BIP125_RBF_SEQUENCE, **next(u for u in node.listunspent() if u["amount"] == Decimal("0.00100000")))
|
||||||
destinations = {dest_address: Decimal("0.00050000")}
|
destinations = {dest_address: Decimal("0.00050000")}
|
||||||
if change_size > 0:
|
if change_size > 0:
|
||||||
destinations[node.getrawchangeaddress()] = change_size
|
destinations[node.getrawchangeaddress()] = change_size
|
||||||
|
@ -8,7 +8,7 @@ from test_framework.address import key_to_p2wpkh
|
|||||||
from test_framework.blocktools import COINBASE_MATURITY
|
from test_framework.blocktools import COINBASE_MATURITY
|
||||||
from test_framework.key import ECKey
|
from test_framework.key import ECKey
|
||||||
from test_framework.test_framework import BitcoinTestFramework
|
from test_framework.test_framework import BitcoinTestFramework
|
||||||
from test_framework.messages import BIP125_SEQUENCE_NUMBER
|
from test_framework.messages import MAX_BIP125_RBF_SEQUENCE
|
||||||
from test_framework.util import (
|
from test_framework.util import (
|
||||||
assert_array_result,
|
assert_array_result,
|
||||||
assert_equal,
|
assert_equal,
|
||||||
@ -346,7 +346,7 @@ class ListSinceBlockTest(BitcoinTestFramework):
|
|||||||
dest_address = spending_node.getnewaddress()
|
dest_address = spending_node.getnewaddress()
|
||||||
|
|
||||||
tx_input = dict(
|
tx_input = dict(
|
||||||
sequence=BIP125_SEQUENCE_NUMBER, **next(u for u in spending_node.listunspent()))
|
sequence=MAX_BIP125_RBF_SEQUENCE, **next(u for u in spending_node.listunspent()))
|
||||||
rawtx = spending_node.createrawtransaction(
|
rawtx = spending_node.createrawtransaction(
|
||||||
[tx_input], {dest_address: tx_input["amount"] - Decimal("0.00051000"),
|
[tx_input], {dest_address: tx_input["amount"] - Decimal("0.00051000"),
|
||||||
spending_node.getrawchangeaddress(): Decimal("0.00050000")})
|
spending_node.getrawchangeaddress(): Decimal("0.00050000")})
|
||||||
|
Loading…
Reference in New Issue
Block a user