mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-03-12 00:26:03 +01:00
rpc: Allow fullrbf fee bump
Also, fix the incorrect documention of the 'replaceable' RPC argument with respect to sequence number handling. The docs were incorrect before, so the fix could be extracted, but it seems fine to include here as well.
This commit is contained in:
@@ -42,6 +42,7 @@ COIN = 100000000 # 1 btc in satoshis
|
||||
MAX_MONEY = 21000000 * COIN
|
||||
|
||||
MAX_BIP125_RBF_SEQUENCE = 0xfffffffd # Sequence number that is rbf-opt-in (BIP 125) and csv-opt-out (BIP 68)
|
||||
MAX_SEQUENCE_NONFINAL = 0xfffffffe # Sequence number that is csv-opt-out (BIP 68)
|
||||
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
|
||||
|
||||
@@ -20,6 +20,7 @@ from test_framework.blocktools import (
|
||||
)
|
||||
from test_framework.messages import (
|
||||
MAX_BIP125_RBF_SEQUENCE,
|
||||
MAX_SEQUENCE_NONFINAL,
|
||||
)
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.util import (
|
||||
@@ -93,7 +94,7 @@ class BumpFeeTest(BitcoinTestFramework):
|
||||
test_simple_bumpfee_succeeds(self, mode, rbf_node, peer_node, dest_address)
|
||||
self.test_invalid_parameters(rbf_node, peer_node, dest_address)
|
||||
test_segwit_bumpfee_succeeds(self, rbf_node, dest_address)
|
||||
test_nonrbf_bumpfee_fails(self, peer_node, dest_address)
|
||||
test_nonrbf_bumpfee_succeeds(self, peer_node, dest_address)
|
||||
test_notmine_bumpfee(self, rbf_node, peer_node, dest_address)
|
||||
test_bumpfee_with_descendant_fails(self, rbf_node, rbf_node_address, dest_address)
|
||||
test_bumpfee_with_abandoned_descendant_succeeds(self, rbf_node, rbf_node_address, dest_address)
|
||||
@@ -371,10 +372,10 @@ def test_segwit_bumpfee_succeeds(self, rbf_node, dest_address):
|
||||
self.clear_mempool()
|
||||
|
||||
|
||||
def test_nonrbf_bumpfee_fails(self, peer_node, dest_address):
|
||||
self.log.info('Test that we cannot replace a non RBF transaction')
|
||||
def test_nonrbf_bumpfee_succeeds(self, peer_node, dest_address):
|
||||
self.log.info("Test that we can replace a non RBF transaction")
|
||||
not_rbfid = peer_node.sendtoaddress(dest_address, Decimal("0.00090000"))
|
||||
assert_raises_rpc_error(-4, "Transaction is not BIP 125 replaceable", peer_node.bumpfee, not_rbfid)
|
||||
peer_node.bumpfee(not_rbfid)
|
||||
self.clear_mempool()
|
||||
|
||||
|
||||
@@ -677,11 +678,20 @@ def test_rebumping(self, rbf_node, dest_address):
|
||||
|
||||
|
||||
def test_rebumping_not_replaceable(self, rbf_node, dest_address):
|
||||
self.log.info('Test that re-bumping non-replaceable fails')
|
||||
self.log.info("Test that re-bumping non-replaceable passes")
|
||||
rbfid = spend_one_input(rbf_node, dest_address)
|
||||
|
||||
def check_sequence(tx, seq_in):
|
||||
tx = rbf_node.getrawtransaction(tx["txid"])
|
||||
tx = rbf_node.decoderawtransaction(tx)
|
||||
seq = [i["sequence"] for i in tx["vin"]]
|
||||
assert_equal(seq, [seq_in])
|
||||
|
||||
bumped = rbf_node.bumpfee(rbfid, fee_rate=ECONOMICAL, replaceable=False)
|
||||
assert_raises_rpc_error(-4, "Transaction is not BIP 125 replaceable", rbf_node.bumpfee, bumped["txid"],
|
||||
{"fee_rate": NORMAL})
|
||||
check_sequence(bumped, MAX_SEQUENCE_NONFINAL)
|
||||
bumped = rbf_node.bumpfee(bumped["txid"], {"fee_rate": NORMAL})
|
||||
check_sequence(bumped, MAX_BIP125_RBF_SEQUENCE)
|
||||
|
||||
self.clear_mempool()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user