Open moneymanolis opened 1 year ago
Seems like #36 was not good enough. @PaarthAgarwal can you have a look?!
In the case of the whitepaper, it's called like this:
raw_tx = app.specter.rpc.getrawtransaction(
"54e48e5f5c656b26c3bca14a8c95aa583d07ebe84dde3b7dd4a78f4e4186e713",
False,
"00000000000000ecbbff6bafb7efa2f7df05b227d5c73dca8f2635af32a2e949",
)
Which creates this stacktrace:
Traceback (most recent call last):
File "/home/kim/src/specter-desktop/.env/lib/python3.10/site-packages/flask/app.py", line 1523, in full_dispatch_request
rv = self.dispatch_request()
File "/home/kim/src/specter-desktop/.env/lib/python3.10/site-packages/flask/app.py", line 1509, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
File "/home/kim/src/specter-desktop/.env/lib/python3.10/site-packages/flask_login/utils.py", line 272, in decorated_view
return func(*args, **kwargs)
File "/home/kim/src/specter-desktop/src/cryptoadvance/specter/server_endpoints/welcome/welcome.py", line 101, in get_whitepaper
raw_tx = app.specter.rpc.getrawtransaction(
File "/home/kim/src/specter-desktop/src/cryptoadvance/specter/rpc.py", line 495, in fn
r = self.multi([(method, *args)], **kwargs)[0]
File "/home/kim/src/specter-desktop/src/cryptoadvance/specterext/spectrum/bridge_rpc.py", line 96, in multi
result = [
File "/home/kim/src/specter-desktop/src/cryptoadvance/specterext/spectrum/bridge_rpc.py", line 97, in <listcomp>
self.spectrum.jsonrpc(
File "/home/kim/src/specter-desktop/.env/lib/python3.10/site-packages/cryptoadvance/spectrum/spectrum.py", line 386, in jsonrpc
raise e
File "/home/kim/src/specter-desktop/.env/lib/python3.10/site-packages/cryptoadvance/spectrum/spectrum.py", line 376, in jsonrpc
res = m(*args, **kwargs)
File "/home/kim/src/specter-desktop/.env/lib/python3.10/site-packages/cryptoadvance/spectrum/spectrum.py", line 53, in wrapper
return f(*args, **kwargs)
TypeError: Spectrum.getrawtransaction() takes from 2 to 3 positional arguments but 4 were given
Seems like #36 was not good enough. @PaarthAgarwal can you have a look?!
In the case of the whitepaper, it's called like this:
raw_tx = app.specter.rpc.getrawtransaction( "54e48e5f5c656b26c3bca14a8c95aa583d07ebe84dde3b7dd4a78f4e4186e713", False, "00000000000000ecbbff6bafb7efa2f7df05b227d5c73dca8f2635af32a2e949", )
Which creates this stacktrace:
Traceback (most recent call last): File "/home/kim/src/specter-desktop/.env/lib/python3.10/site-packages/flask/app.py", line 1523, in full_dispatch_request rv = self.dispatch_request() File "/home/kim/src/specter-desktop/.env/lib/python3.10/site-packages/flask/app.py", line 1509, in dispatch_request return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args) File "/home/kim/src/specter-desktop/.env/lib/python3.10/site-packages/flask_login/utils.py", line 272, in decorated_view return func(*args, **kwargs) File "/home/kim/src/specter-desktop/src/cryptoadvance/specter/server_endpoints/welcome/welcome.py", line 101, in get_whitepaper raw_tx = app.specter.rpc.getrawtransaction( File "/home/kim/src/specter-desktop/src/cryptoadvance/specter/rpc.py", line 495, in fn r = self.multi([(method, *args)], **kwargs)[0] File "/home/kim/src/specter-desktop/src/cryptoadvance/specterext/spectrum/bridge_rpc.py", line 96, in multi result = [ File "/home/kim/src/specter-desktop/src/cryptoadvance/specterext/spectrum/bridge_rpc.py", line 97, in <listcomp> self.spectrum.jsonrpc( File "/home/kim/src/specter-desktop/.env/lib/python3.10/site-packages/cryptoadvance/spectrum/spectrum.py", line 386, in jsonrpc raise e File "/home/kim/src/specter-desktop/.env/lib/python3.10/site-packages/cryptoadvance/spectrum/spectrum.py", line 376, in jsonrpc res = m(*args, **kwargs) File "/home/kim/src/specter-desktop/.env/lib/python3.10/site-packages/cryptoadvance/spectrum/spectrum.py", line 53, in wrapper return f(*args, **kwargs) TypeError: Spectrum.getrawtransaction() takes from 2 to 3 positional arguments but 4 were given
Did some research. I don't know how to test but adding a 4th parameter hex string here might do the trick. https://github.com/cryptoadvance/spectrum/blob/fa87be3f8c0fdf1628941d0558e065c666092079/src/cryptoadvance/spectrum/spectrum.py#L580
To clarify a bit and give some background: @PaarthAgarwal
In Specter using Bitcoin Core getrawtransaction
is called exactly like it is specified here:
https://developer.bitcoin.org/reference/rpc/getrawtransaction.html?highlight=getrawtransaction
00000000000000ecbbff6bafb7efa2f7df05b227d5c73dca8f2635af32a2e949
is the blockhash where the tx with the whitepaper data can be found. This is an optional argument but it speeds up the feature. So I would just add this.
You can test this in the end pretty easily, connect via Spectrum to one of the main chain provider (emzy or Blockstream server).
Thanks for the clarification @moneymanolis. I appreciate that. Will open a PR soon with the fix. Also, I'm glad to share I just now cleared the screening round of the Summer of Bitcoin!🎉🎉
Implementing the
getrawtransaction
method in Spectrum should make it possible to retrieve the whitepaper from the timechain with Spectrum.getrawtransaction
is already implemented in the ElectrumX API: https://electrumx.readthedocs.io/en/latest/protocol-methods.html#blockchain-transaction-get