mirror of
https://github.com/JoinMarket-Org/joinmarket-clientserver.git
synced 2026-08-13 12:33:40 +02:00
Freeze timelocked UTXOs with locktimes in future
Previously timelocked UTXOs would be returned by calls like select_utxo() and get_utxos_by_mixdepth(). This caused annoyances if trying to burn a single UTXO. It could also cause recently- unlocked coins to accidently get spent, perhaps co-spent with other coins. This commit fixes that by freezing UTXOs with the coin control feature whenever the wallet is sync'd. When the timelock of a coin passes the user must explicitly use coin control to spend it.
This commit is contained in:
parent
ddb32ce245
commit
2860c4fc9f
1 changed files with 13 additions and 0 deletions
|
|
@ -1728,6 +1728,19 @@ class FidelityBondMixin(object):
|
|||
script = self.get_script_from_path(path)
|
||||
self._script_map[script] = path
|
||||
|
||||
def add_utxo(self, txid, index, script, value, height=None):
|
||||
super(FidelityBondMixin, self).add_utxo(txid, index, script, value,
|
||||
height)
|
||||
#dont use coin control freeze if wallet readonly
|
||||
if self._storage.read_only:
|
||||
return
|
||||
path = self.script_to_path(script)
|
||||
if not self.is_timelocked_path(path):
|
||||
return
|
||||
if datetime.utcfromtimestamp(path[-1]) > datetime.now():
|
||||
#freeze utxo if its timelock is in the future
|
||||
self.disable_utxo(txid, index, disable=True)
|
||||
|
||||
def get_bip32_pub_export(self, mixdepth=None, address_type=None):
|
||||
bip32_pub = super(FidelityBondMixin, self).get_bip32_pub_export(mixdepth, address_type)
|
||||
if address_type == None and mixdepth == self.FIDELITY_BOND_MIXDEPTH:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue