Compare commits
8
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dcc5415648 | ||
|
|
3c38a88b22 | ||
|
|
187b7670b1 | ||
|
|
049c17ff08 | ||
|
|
8de97bb441 | ||
|
|
97c0092923 | ||
|
|
e65e1fb5a2 | ||
|
|
20dd1e55f5 |
No files matched your search
+1
-1
@@ -3,7 +3,7 @@ from lbrynet.custom_logger import install_logger
|
||||
|
||||
|
||||
__name__ = "lbrynet"
|
||||
__version__ = "0.30.3"
|
||||
__version__ = "0.30.4"
|
||||
version = tuple(__version__.split('.'))
|
||||
|
||||
install_logger()
|
||||
|
||||
+7
-3
@@ -35,9 +35,10 @@ MB = 2 ** 20
|
||||
DEFAULT_CONCURRENT_ANNOUNCERS = 10
|
||||
|
||||
DEFAULT_DHT_NODES = [
|
||||
('lbrynet1.lbry.io', 4444),
|
||||
('lbrynet2.lbry.io', 4444),
|
||||
('lbrynet3.lbry.io', 4444)
|
||||
('lbrynet1.lbry.io', 4444), # US EAST
|
||||
('lbrynet2.lbry.io', 4444), # US WEST
|
||||
('lbrynet3.lbry.io', 4444), # EU
|
||||
('lbrynet4.lbry.io', 4444) # ASIA
|
||||
]
|
||||
|
||||
settings_decoders = {
|
||||
@@ -287,8 +288,11 @@ class Config:
|
||||
self.default_data_dir, self.default_wallet_dir, self.default_download_dir = get_linux_directories()
|
||||
else:
|
||||
assert None not in [data_dir, wallet_dir, download_dir]
|
||||
if data_dir:
|
||||
self.default_data_dir = data_dir
|
||||
if wallet_dir:
|
||||
self.default_wallet_dir = wallet_dir
|
||||
if download_dir:
|
||||
self.default_download_dir = download_dir
|
||||
|
||||
self._data = {
|
||||
|
||||
@@ -207,7 +207,7 @@ def main(argv=None):
|
||||
return 1
|
||||
|
||||
dir_args = {}
|
||||
if len(argv) > 2:
|
||||
if len(argv) >= 2:
|
||||
dir_arg_keys = [
|
||||
'data_dir',
|
||||
'wallet_dir',
|
||||
|
||||
@@ -2768,6 +2768,26 @@ class Daemon(AuthJSONRPCServer):
|
||||
page, page_size
|
||||
)
|
||||
|
||||
@requires(WALLET_COMPONENT)
|
||||
def jsonrpc_utxo_release(self, account_id=None):
|
||||
"""
|
||||
When spending a UTXO it is locally locked to prevent double spends;
|
||||
occasionally this can result in a UTXO being locked which ultimately
|
||||
did not get spent (failed to broadcast, spend transaction was not
|
||||
accepted by blockchain node, etc). This command releases the lock
|
||||
on all UTXOs in your account.
|
||||
|
||||
Usage:
|
||||
utxo_release [<account_id> | --account_id=<account_id>]
|
||||
|
||||
Options:
|
||||
--account_id=<account_id> : (str) id of the account to query
|
||||
|
||||
Returns:
|
||||
None
|
||||
"""
|
||||
return self.get_account_or_default(account_id).release_all_outputs()
|
||||
|
||||
@requires(WALLET_COMPONENT)
|
||||
def jsonrpc_block_show(self, blockhash=None, height=None):
|
||||
"""
|
||||
|
||||
@@ -236,3 +236,6 @@ class Account(BaseAccount):
|
||||
)
|
||||
|
||||
return tx
|
||||
|
||||
async def release_all_outputs(self):
|
||||
await self.ledger.db.release_all_outputs(self)
|
||||
@@ -117,3 +117,11 @@ class WalletDatabase(BaseDatabase):
|
||||
channel.private_key = private_key
|
||||
certificates.append(channel)
|
||||
return certificates
|
||||
|
||||
async def release_all_outputs(self, account):
|
||||
await self.db.execute(
|
||||
"UPDATE txo SET is_reserved = 0 WHERE"
|
||||
" is_reserved = 1 AND txo.address IN ("
|
||||
" SELECT address from pubkey_address WHERE account = ?"
|
||||
" )", [account.public_key.address]
|
||||
)
|
||||
@@ -137,3 +137,8 @@ class LBCRegTest(LBC):
|
||||
XPRV_VERBYTES = bytes.fromhex('04358394')
|
||||
P2PKH_VERBYTE = bytes.fromhex("6f")
|
||||
P2SH_VERBYTES = bytes.fromhex("c4")
|
||||
|
||||
|
||||
class LBCTestNet(LBCRegTest):
|
||||
NET = "testnet"
|
||||
GENESIS_HASH = '9c89283ba0f3227f6c03b70216b9f665f0118d5e0fa729cedf4fb34d6a34f463'
|
||||
@@ -0,0 +1,49 @@
|
||||
FROM debian:buster-slim
|
||||
|
||||
ARG user=lbry
|
||||
|
||||
# create an unprivileged user
|
||||
RUN groupadd -g 999 $user && useradd -r -u 999 -g $user $user
|
||||
RUN mkdir -p /home/$user/
|
||||
RUN chown -R $user:$user /home/$user/
|
||||
|
||||
# install python, pip, git and clean up
|
||||
RUN apt-get update && apt-get -y --no-install-recommends install build-essential git python3.7 python3.7-dev python3-pip && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# create and chown database dir
|
||||
ARG db_dir=/database
|
||||
RUN mkdir -p $db_dir
|
||||
RUN chown -R $user:$user $db_dir
|
||||
|
||||
# change into our user
|
||||
USER $user
|
||||
WORKDIR /home/$user
|
||||
|
||||
# RUN pip3 install -U pip (broken on pip 10 https://github.com/pypa/pip/issues/5240)
|
||||
RUN python3.7 -m pip install --upgrade pip setuptools
|
||||
|
||||
# get torba
|
||||
RUN python3.7 -m pip install --user git+https://github.com/lbryio/torba.git#egg=torba
|
||||
|
||||
# copy lbrynet
|
||||
RUN mkdir projects/
|
||||
COPY . projects/lbry
|
||||
USER root
|
||||
RUN chown -R $user:$user .
|
||||
USER $user
|
||||
WORKDIR projects/lbry
|
||||
RUN python3.7 -m pip install --user -e . && rm ~/.cache -rf
|
||||
|
||||
# entry point
|
||||
ARG host=0.0.0.0
|
||||
ARG tcp_port=50001
|
||||
ARG daemon_url=http://lbry:lbry@localhost:9245/
|
||||
VOLUME $db_dir
|
||||
ENV TCP_PORT=$tcp_port
|
||||
ENV HOST=$host
|
||||
ENV DAEMON_URL=$daemon_url
|
||||
ENV DB_DIRECTORY=$db_dir
|
||||
ENV BANDWIDTH_LIMIT=1000000000000000000000000000000000000000000
|
||||
ENV MAX_SESSIONS=1000000000
|
||||
ENV MAX_SEND=1000000000000000000
|
||||
ENTRYPOINT ["/home/lbry/.local/bin/torba-server"]
|
||||
@@ -846,3 +846,14 @@ class TransactionCommandsTestCase(CommandTestCase):
|
||||
# inexistent
|
||||
result = await self.daemon.jsonrpc_transaction_show('0'*64)
|
||||
self.assertFalse(result['success'])
|
||||
|
||||
async def test_utxo_release(self):
|
||||
sendtxid = await self.blockchain.send_to_address(
|
||||
await self.account.receiving.get_or_create_usable_address(), 1
|
||||
)
|
||||
await self.confirm_tx(sendtxid)
|
||||
await self.assertBalance(self.account, '11.0')
|
||||
await self.ledger.reserve_outputs(await self.account.get_utxos())
|
||||
await self.assertBalance(self.account, '0.0')
|
||||
await self.daemon.jsonrpc_utxo_release()
|
||||
await self.assertBalance(self.account, '11.0')
|
||||
Reference in new issue
Block a user