diff --git a/bitcoin/__init__.py b/bitcoin/__init__.py index d52d9145..1c0d6ee3 100644 --- a/bitcoin/__init__.py +++ b/bitcoin/__init__.py @@ -53,6 +53,16 @@ class RegTestParams(bitcoin.core.CoreRegTestParams): 'SCRIPT_ADDR':196, 'SECRET_KEY' :239} +## Crudely making this multi-coin aware! +class RegTestDashParams(bitcoin.core.CoreRegTestParams): + #MESSAGE_START = b'\xfa\xbf\xb5\xda' + #DEFAULT_PORT = 18444 + RPC_PORT = 19998 + #DNS_SEEDS = () + BASE58_PREFIXES = {'PUBKEY_ADDR':140, + 'SCRIPT_ADDR':19, + 'SECRET_KEY' :239} + """Master global setting for what chain params we're using. However, don't set this directly, use SelectParams() instead so as to set the @@ -64,17 +74,27 @@ class RegTestParams(bitcoin.core.CoreRegTestParams): def SelectParams(name): """Select the chain parameters to use - name is one of 'mainnet', 'testnet', or 'regtest' + name is one of 'mainnet', 'testnet', 'regtest' or 'regtest-DASH' Default chain is 'mainnet' """ global params - bitcoin.core._SelectCoreParams(name) + + + ## We are abusing 'name' to mean both network+COIN. There is + ## probably a much better way to do this! + core_name = name + if name == 'regtest-DASH': + core_name = 'regtest' + + bitcoin.core._SelectCoreParams(core_name) if name == 'mainnet': params = bitcoin.core.coreparams = MainParams() elif name == 'testnet': params = bitcoin.core.coreparams = TestNetParams() elif name == 'regtest': params = bitcoin.core.coreparams = RegTestParams() + elif name == 'regtest-DASH': + params = bitcoin.core.coreparams = RegTestDashParams() else: raise ValueError('Unknown chain %r' % name) diff --git a/bitcoin/rpc.py b/bitcoin/rpc.py index f2c5d4a5..0a5f83d9 100644 --- a/bitcoin/rpc.py +++ b/bitcoin/rpc.py @@ -562,7 +562,10 @@ def getreceivedbyaddress(self, addr, minconf=1): r = self._call('getreceivedbyaddress', str(addr), minconf) return int(r * COIN) - def gettransaction(self, txid): + def getblockchaininfo(self): + return self._call('getblockchaininfo') + + def gettransaction(self, txid, includewatchonly=False): """Get detailed information about in-wallet transaction txid Raises IndexError if transaction not found in the wallet. @@ -570,7 +573,7 @@ def gettransaction(self, txid): FIXME: Returned data types are not yet converted. """ try: - r = self._call('gettransaction', b2lx(txid)) + r = self._call('gettransaction', b2lx(txid), includewatchonly) except InvalidAddressOrKeyError as ex: raise IndexError('%s.getrawtransaction(): %s (%d)' % (self.__class__.__name__, ex.error['message'], ex.error['code']))