Skip to content

Commit 69be70c

Browse files
committed
Add generate RPC call
1 parent 15f4186 commit 69be70c

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

bitcoin/rpc.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,16 @@ def fundrawtransaction(self, tx, include_watching=False):
318318

319319
return r
320320

321+
def generate(self, numblocks):
322+
"""Mine blocks immediately (before the RPC call returns)
323+
324+
numblocks - How many blocks are generated immediately.
325+
326+
Returns iterable of block hashes generated.
327+
"""
328+
r = self._call('generate', numblocks)
329+
return (lx(blk_hash) for blk_hash in r)
330+
321331
def getaccountaddress(self, account=None):
322332
"""Return the current Bitcoin address for receiving payments to this
323333
account."""

0 commit comments

Comments
 (0)