-
Notifications
You must be signed in to change notification settings - Fork 902
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pytest: test Bitcoin plugin registration and the bcli plugin
- Loading branch information
Showing
4 changed files
with
149 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/usr/bin/env python3 | ||
""" | ||
This registers part of the Bitcoin backend methods. | ||
We only use it for testing startup and we don't care about the actual values. | ||
""" | ||
import time | ||
|
||
from pyln.client import Plugin | ||
|
||
|
||
plugin = Plugin() | ||
|
||
|
||
@plugin.method("getfeerate") | ||
def getfeerate(plugin, **kwargs): | ||
time.sleep(1) | ||
return {} | ||
|
||
|
||
@plugin.method("getrawblockbyheight") | ||
def getblock(plugin, **kwargs): | ||
time.sleep(1) | ||
return {} | ||
|
||
|
||
@plugin.method("getchaininfo") | ||
def getchaininfo(plugin, **kwargs): | ||
time.sleep(1) | ||
return {} | ||
|
||
|
||
# We don't use these options, but it allows us to get to the expected failure. | ||
plugin.add_option("bitcoin-rpcuser", "", "") | ||
plugin.add_option("bitcoin-rpcpassword", "", "") | ||
plugin.add_option("bitcoin-rpcport", "", "") | ||
|
||
plugin.run() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/usr/bin/env python3 | ||
""" | ||
This registers part of the Bitcoin backend methods. | ||
We only use it for testing startup and we don't care about the actual values. | ||
""" | ||
import time | ||
|
||
from pyln.client import Plugin | ||
|
||
|
||
plugin = Plugin() | ||
|
||
|
||
@plugin.method("sendrawtransaction") | ||
def sendtx(plugin, **kwargs): | ||
time.sleep(1) | ||
return {} | ||
|
||
|
||
@plugin.method("gettxout") | ||
def gettxout(plugin, **kwargs): | ||
time.sleep(1) | ||
return {} | ||
|
||
|
||
plugin.run() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters