bugfix: use enumerate instead of len
reviewed estimation of transaction sizes
estimates are still a bit conservative with room for improvement;
signatures could still save up to one byte each if using low-r
values. python-bitcointx==1.1.2-dev already supports grinding for
low-r values so when it's stable and referenced version is updated,
this should be reviewed again so as to utilize that benefit.
added utility method `estimate_extra_bytes`
the purpose of this method is for the computation
of extra bytes when the coinjoin or direct send output
type is different from that of the wallet
updated tests to reflect new transaction size
computation
p2pkh transactions are now 1 byte larger for
the inputs hence the change amount should be
less 4 * 30 sats.
add private keys for utxos that we may not be
tracking
some transactions (e.g. opt-in rbf) may require signing
with private keys for utxos that we may have stopped
tracking. this commit will search through all inputs
and for those we own and retrieve their private keys
so we can sign with them.
added support for p2wsh output scripts in
refactored the estimation of the transaction size
when outputs of a different type is the target
Previously, a different method was employed which
was kind of kludgy considering the fact that the
`extra_bytes` parameter is really for `OP_RETURN`
outputs. This method modifies the `estimate_tx_size`
method to accept an optional extra parameter called
`outtype` which is used to estimate the correct
transaction size if the target output is different
from that of the wallet.
added missing import
added a note about preserving the order of wallet type constants
Fix bug with timelocked addrs in receive payjoin
Previously there would be a crash if the wallet receiving a payjoin
had a timelocked UTXO.
Fixes#889.
Prior to this commit, it was possible for the
yg-privacyenhanced.py script to go into an infinite
loop of attempting to halve the txfee setting, in case
the user selected (a) reloffer, (b) an absurdly low
minsize like 1 sat, and (c) a txfee of zero.
This occurred partially due to the randomization of minsizes
included in the yg-pe algorithm, which could lead to a
pathological zero value for minsize.
After this commit the minsize is automatically bumped to
the `DUST_THRESHOLD` value if it falls below it, preventing
the possibility of a nonsensical value.
Additionally, the loop which halves the txfee is no longer
allowed to continue beyond 20 iterations, as an extra sanity
check.
Overwrite the selection logic of mixdepth with the cyclic order one. Improve comment to explain why modulo is used only for the first available mixdepth.
Nit correction
Co-authored-by: Kristaps Kaupe <kristaps@blogiem.lv>
Allow YG settings to be saved to joinmarket.cfg.
Before this commit, yield generator settings were
set inside the python script, which is not good.
After this commit, the order of precedence for the
settings for a yield generator is:
* Command line arguments, or
* Settings in [YIELDGENERATOR] in joinmarket.cfg, or
* default config settings in jmclient.configure.py
Before this commit, the yg-privacyenhanced.py script,
which always randomizes coinjoin fees, was not including
`sw0absoffer` in the offertypes for which the randomized
fee must be kept as an integer, not as a decimal, resulting
in those offers being ignored by other bots.
After this commit, `sw0absoffer` (as well as `swabsoffer`)
offers always use integer coinjoin fees, as intended.
* yg scripts set reloffer/absoffer only:
Prior to this commit, the yield generator user
level scripts required the user to specify offer
types depending on the wallet, but only 'rel/abs'
distinction is user choice; the other element
(native segwit, p2sh or p2pkh) must be defined
by the wallet, so we now call `wallet.get_txtype()`
to translate from reloffer/absoffer to sw0.. etc.
* Taker chooses nversion, nlocktime per wallet type:
Takers who are still using p2sh-p2wpkh wallets will
not want to flag their transactions with different
tx metadata than previous versions that are still
running, so we check the `get_txtype()` output to
decide which nVersion and nLockTime to use.
Also, the SNICKER locktime is reverted to zero as
according to draft spec.
* change offer type in test_coinjoin
* update docs for bech32 wallets
Probably a value from the past, when BTC was worth considerably less.
To align with yg-basic, which already uses this lower min size.
Improves orderbook liquidity for smaller amounts.
Introduces WalletService object which is in control of
blockchain and wallet access.
The service manages a single transaction monitoring loop,
instead of multiple, and allows updates to the wallet from
external sources to be handled in real time, so that both Qt
and other apps (yg) can respond to deposits or withdrawals
automatically.
The refactoring also controls access to both wallet and
blockchain so that client apps (Taker, Maker) will not need
to be changed for future new versions e.g. client-side filtering.
Also updates and improves Wallet Tab behaviour in Qt (memory
of expansion state).
Additionally, blockchain sync is now --fast by default, with
the former default of detailed sync being renamed --recoversync.
This refactors YieldGeneratorBasic a bit. In particular, we move things
that custom algorithms will most likely want to change to separate
functions. That way, it is easy to define the behaviour of inputs
and outputs for the join without the need to duplicate the other, more
general logic of create_my_orders and oid_to_order.
Previous to this commit, the jmbitcoin package was accessed via
a file in jmclient `btc.py` which was originally added as an
interface to allow the client to use a non-jmbitcoin package to
provide the implementation; while this idea is useful, the way
it was implemented was not, moreover it is not currently used
and contained duplicated code that was unmanaged. Also, the
original usage of this was only by the electrum plugin, which
has currently been abandoned. This simplifies the code and
avoids spurious error messages. Note that most of the changes
are a result of pulling the logging function directly from the
jmbase package instead of indirectly via this interface (which
was unnecessary and not connected with jmbitcoin).