def test_segwit_bumpfee_succeeds(rbf_node, dest_address):
    segwit_in = next((u for u in rbf_node.listunspent() if (u['amount'] == Decimal('0.1'))))
    segwit_out = rbf_node.validateaddress(rbf_node.getnewaddress())
    rbf_node.addwitnessaddress(segwit_out['address'])
    segwitid = send_to_witness(version=0, node=rbf_node, utxo=segwit_in, pubkey=segwit_out['pubkey'], encode_p2sh=False, amount=Decimal('0.09'), sign=True)
    rbfraw = rbf_node.createrawtransaction([{'txid': segwitid, 'vout': 0, 'sequence': BIP125_SEQUENCE_NUMBER}], {dest_address: Decimal('0.05'), get_change_address(rbf_node): Decimal('0.03')})
    rbfsigned = rbf_node.signrawtransaction(rbfraw)
    rbfid = rbf_node.sendrawtransaction(rbfsigned['hex'])
    assert (rbfid in rbf_node.getrawmempool())
    bumped_tx = rbf_node.bumpfee(rbfid)
    assert (bumped_tx['txid'] in rbf_node.getrawmempool())
    assert (rbfid not in rbf_node.getrawmempool())
def test_segwit_bumpfee_succeeds(rbf_node, dest_address):
    segwit_in = next((u for u in rbf_node.listunspent() if (u['amount'] == Decimal('0.1'))))
    segwit_out = rbf_node.validateaddress(rbf_node.getnewaddress())
    rbf_node.addwitnessaddress(segwit_out['address'])
    segwitid = send_to_witness(version=0, node=rbf_node, utxo=segwit_in, pubkey=segwit_out['pubkey'], encode_p2sh=False, amount=Decimal('0.09'), sign=True)
    rbfraw = rbf_node.createrawtransaction([{'txid': segwitid, 'vout': 0, 'sequence': BIP125_SEQUENCE_NUMBER}], {dest_address: Decimal('0.05'), get_change_address(rbf_node): Decimal('0.03')})
    rbfsigned = rbf_node.signrawtransaction(rbfraw)
    rbfid = rbf_node.sendrawtransaction(rbfsigned['hex'])
    assert (rbfid in rbf_node.getrawmempool())
    bumped_tx = rbf_node.bumpfee(rbfid)
    assert (bumped_tx['txid'] in rbf_node.getrawmempool())
    assert (rbfid not in rbf_node.getrawmempool())