Browse Source

Drop support for pre-0.17 Bitcoin Core

master
Kristaps Kaupe 5 years ago
parent
commit
81982c729f
  1. 4
      docs/INSTALL.md
  2. 2
      docs/PAYJOIN.md
  3. 2
      docs/TESTING.md
  4. 27
      jmclient/jmclient/blockchaininterface.py

4
docs/INSTALL.md

@ -117,9 +117,11 @@ Before starting, note you need either (a) Bitcoin Core installed on Windows or (
If (a), then note the following two points:
##### Installing Bitcoin Core
If you haven't done so yet, install Bitcoin Core as described [here](https://bitcoin.org/en/full-node#windows-10). After starting it for the first time, it will start the Initial Block Download. JoinMarket cannot be used until this is finished. More information on that can be found [here](https://bitcoin.org/en/full-node#initial-block-downloadibd).
If you haven't done so yet, install Bitcoin Core, version 0.18 or newer, as described [here](https://bitcoin.org/en/full-node#windows-10). After starting it for the first time, it will start the Initial Block Download. JoinMarket cannot be used until this is finished. More information on that can be found [here](https://bitcoin.org/en/full-node#initial-block-downloadibd).
##### Configuring Bitcoin Core
Bitcoin Core needs to be configured to allow JoinMarket to connect to it. From the `Settings` menu choose `Options` and click `Open Configuration File`. Add `server=1`, save and close the file. After that restart Bitcoin Core.
There are currently two choices for installing on Windows; one, directly installing on Windows, requiring the manual addition of a libsodium dependency, or, two, using Ubuntu via the WSL mechanism (which may require additional setup to make the Qt GUI work).

2
docs/PAYJOIN.md

@ -39,7 +39,7 @@ So just skip those sections if you already know it.
### Preparatory step: configuring for Bitcoin Core.
Joinmarket currently requires a Bitcoin Core full node, although it can be pruned.
Joinmarket currently requires a Bitcoin Core full node, version 0.18 or newer, although it can be pruned.
First thing to do: in `scripts/`, run:

2
docs/TESTING.md

@ -1,6 +1,6 @@
### Test instructions (for developers):
Work in your `jmvenv` virtualenv as for all Joinmarket work. Make sure to have [bitcoind](https://bitcoin.org/en/full-node) 0.17 or newer installed. Also need miniircd installed to the root (i.e. in your `joinmarket-clientserver` directory):
Work in your `jmvenv` virtualenv as for all Joinmarket work. Make sure to have [bitcoind](https://bitcoin.org/en/full-node) 0.18 or newer installed. Also need miniircd installed to the root (i.e. in your `joinmarket-clientserver` directory):
(jmvenv)$ cd /path/to/joinmarket-clientserver
(jmvenv)$ git clone https://github.com/Joinmarket-Org/miniircd

27
jmclient/jmclient/blockchaininterface.py

@ -184,9 +184,6 @@ class BitcoinCoreInterface(BlockchainInterface):
raise Exception('wrong network configured')
def is_address_imported(self, addr):
try:
return self._rpc('getaccount', [addr]) != ''
except JsonRpcError:
return len(self._rpc('getaddressinfo', [addr])['labels']) > 0
def get_block(self, blockheight):
@ -232,11 +229,7 @@ class BitcoinCoreInterface(BlockchainInterface):
return res
def is_address_labeled(self, utxo, walletname):
# Bitcoin Core before 0.17 used accounts, new versions has labels
return (
("label" in utxo and utxo["label"] == walletname) or
("account" in utxo and utxo["account"] == walletname)
)
return ("label" in utxo and utxo["label"] == walletname)
def import_addresses(self, addr_list, wallet_name, restart_cb=None):
"""Imports addresses in a batch during initial sync.
@ -275,10 +268,6 @@ class BitcoinCoreInterface(BlockchainInterface):
sys.exit(EXIT_FAILURE)
def import_addresses_if_needed(self, addresses, wallet_name):
try:
imported_addresses = set(self._rpc('getaddressesbyaccount',
[wallet_name]))
except JsonRpcError:
if wallet_name in self._rpc('listlabels', []):
imported_addresses = set(self._rpc('getaddressesbylabel',
[wallet_name]).keys())
@ -327,12 +316,8 @@ class BitcoinCoreInterface(BlockchainInterface):
watch-only wallets.
"""
htxid = bintohex(txid)
#changed syntax in 0.14.0; allow both syntaxes
try:
res = self._rpc("gettransaction", [htxid, True])
except Exception as e:
try:
res = self._rpc("gettransaction", [htxid, 1])
except JsonRpcError as e:
#This should never happen (gettransaction is a wallet rpc).
log.warn("Failed gettransaction call; JsonRpcError: " + repr(e))
@ -345,7 +330,7 @@ class BitcoinCoreInterface(BlockchainInterface):
# happens in case of rpc connection failure:
return None
if "confirmations" not in res:
log.warning("Malformed gettx result: " + str(res))
log.warning("Malformed gettransaction result: " + str(res))
return None
return res
@ -479,11 +464,7 @@ class BitcoinCoreInterface(BlockchainInterface):
return self._rpc('getblockchaininfo', [])['mediantime']
def _get_block_header_data(self, blockhash, key):
try:
# works with pruning enabled, but only after v0.12
return self._rpc('getblockheader', [blockhash])[key]
except JsonRpcError:
return self._rpc('getblock', [blockhash])[key]
def get_block_height(self, blockhash):
return self._get_block_header_data(blockhash, 'height')
@ -594,13 +575,9 @@ class BitcoinCoreNoHistoryInterface(BitcoinCoreInterface, RegtestBitcoinCoreMixi
addr_list = ["addr(" + a + ")" for a in addresses]
log.debug("Starting scan of UTXO set")
st = time.time()
try:
self._rpc("scantxoutset", ["abort", []])
self.scan_result = self._rpc("scantxoutset", ["start",
addr_list])
except JsonRpcError as e:
raise RuntimeError("Bitcoin Core 0.17.0 or higher required "
+ "for no-history sync (" + repr(e) + ")")
et = time.time()
log.debug("UTXO set scan took " + str(et - st) + "sec")
elif self.import_addresses_call_count > 4:

Loading…
Cancel
Save