use maxint-2 to signal RBF, in order to standardize with Bitcoin Core
This commit is contained in:
@@ -148,7 +148,7 @@ class TxDialog(Factory.Popup):
|
|||||||
self.app.show_error(str(e))
|
self.app.show_error(str(e))
|
||||||
return
|
return
|
||||||
if is_final:
|
if is_final:
|
||||||
new_tx.set_sequence(0xffffffff)
|
new_tx.set_rbf(False)
|
||||||
self.tx = new_tx
|
self.tx = new_tx
|
||||||
self.update()
|
self.update()
|
||||||
self.do_sign()
|
self.do_sign()
|
||||||
|
|||||||
@@ -284,7 +284,7 @@ class SendScreen(CScreen):
|
|||||||
self.app.show_error(str(e))
|
self.app.show_error(str(e))
|
||||||
return
|
return
|
||||||
if rbf:
|
if rbf:
|
||||||
tx.set_sequence(0)
|
tx.set_rbf(True)
|
||||||
fee = tx.get_fee()
|
fee = tx.get_fee()
|
||||||
msg = [
|
msg = [
|
||||||
_("Amount to be sent") + ": " + self.app.format_amount_and_units(amount),
|
_("Amount to be sent") + ": " + self.app.format_amount_and_units(amount),
|
||||||
|
|||||||
@@ -1306,7 +1306,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
|
|||||||
|
|
||||||
use_rbf = self.rbf_checkbox.isChecked()
|
use_rbf = self.rbf_checkbox.isChecked()
|
||||||
if use_rbf:
|
if use_rbf:
|
||||||
tx.set_sequence(0)
|
tx.set_rbf(True)
|
||||||
|
|
||||||
if fee < self.wallet.relayfee() * tx.estimated_size() / 1000 and tx.requires_fee(self.wallet):
|
if fee < self.wallet.relayfee() * tx.estimated_size() / 1000 and tx.requires_fee(self.wallet):
|
||||||
self.show_error(_("This transaction requires a higher fee, or it will not be propagated by the network"))
|
self.show_error(_("This transaction requires a higher fee, or it will not be propagated by the network"))
|
||||||
@@ -2823,7 +2823,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
|
|||||||
self.show_error(_('Max fee exceeded'))
|
self.show_error(_('Max fee exceeded'))
|
||||||
return
|
return
|
||||||
new_tx = self.wallet.cpfp(parent_tx, fee)
|
new_tx = self.wallet.cpfp(parent_tx, fee)
|
||||||
new_tx.set_sequence(0)
|
new_tx.set_rbf(True)
|
||||||
self.show_transaction(new_tx)
|
self.show_transaction(new_tx)
|
||||||
|
|
||||||
def bump_fee_dialog(self, tx):
|
def bump_fee_dialog(self, tx):
|
||||||
@@ -2860,5 +2860,5 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
|
|||||||
self.show_error(str(e))
|
self.show_error(str(e))
|
||||||
return
|
return
|
||||||
if is_final:
|
if is_final:
|
||||||
new_tx.set_sequence(0xffffffff)
|
new_tx.set_rbf(False)
|
||||||
self.show_transaction(new_tx)
|
self.show_transaction(new_tx)
|
||||||
|
|||||||
@@ -414,7 +414,7 @@ class Commands:
|
|||||||
coins = self.wallet.get_spendable_coins(domain)
|
coins = self.wallet.get_spendable_coins(domain)
|
||||||
tx = self.wallet.make_unsigned_transaction(coins, final_outputs, self.config, fee, change_addr)
|
tx = self.wallet.make_unsigned_transaction(coins, final_outputs, self.config, fee, change_addr)
|
||||||
if rbf:
|
if rbf:
|
||||||
tx.set_sequence(0)
|
tx.set_rbf(True)
|
||||||
if not unsigned:
|
if not unsigned:
|
||||||
self.wallet.sign_transaction(tx, self._password)
|
self.wallet.sign_transaction(tx, self._password)
|
||||||
return tx
|
return tx
|
||||||
|
|||||||
@@ -681,9 +681,10 @@ class Transaction:
|
|||||||
s += int_to_hex(txin.get('sequence', 0xffffffff), 4)
|
s += int_to_hex(txin.get('sequence', 0xffffffff), 4)
|
||||||
return s
|
return s
|
||||||
|
|
||||||
def set_sequence(self, n):
|
def set_rbf(self, rbf):
|
||||||
|
nSequence = 0xffffffff - (2 if rbf else 0)
|
||||||
for txin in self.inputs():
|
for txin in self.inputs():
|
||||||
txin['sequence'] = n
|
txin['sequence'] = nSequence
|
||||||
|
|
||||||
def BIP_LI01_sort(self):
|
def BIP_LI01_sort(self):
|
||||||
# See https://github.com/kristovatlas/rfc/blob/master/bips/bip-li01.mediawiki
|
# See https://github.com/kristovatlas/rfc/blob/master/bips/bip-li01.mediawiki
|
||||||
|
|||||||
Reference in New Issue
Block a user