From 87e062f159af1cdb1d44634acf12e12681d743de Mon Sep 17 00:00:00 2001 From: Victor Pereira Date: Tue, 13 Apr 2021 18:14:49 +0200 Subject: [PATCH] Implement the rpc command getblocktemplate as described here: https://en.bitcoin.it/wiki/Getblocktemplate --- bitcoin/rpc.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/bitcoin/rpc.py b/bitcoin/rpc.py index 51f24ac9..d7940615 100644 --- a/bitcoin/rpc.py +++ b/bitcoin/rpc.py @@ -763,6 +763,17 @@ def unlockwallet(self, password, timeout=60): r = self._call('walletpassphrase', password, timeout) return r + def getblocktemplate(self, params=None): + """return a candidate block + this implementation (and parameter) implements the the bitcoin-cli getblocktemplate + default behavior + FIXME: implement options + """ + if params is None: + params = {"rules": ["segwit"]} + r = self._call("getblocktemplate", params) + return r + def _addnode(self, node, arg): r = self._call('addnode', node, arg) return r