Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LibTx Error when finalizing a slate returned by issue_send_tx using keybase #2266

Closed
bladedoyle opened this issue Dec 31, 2018 · 2 comments
Closed

Comments

@bladedoyle
Copy link
Contributor

bladedoyle commented Dec 31, 2018

I am not able to get a keybase tx to finalize using the API. This is the best error message I can find:

20181231 13:26:33.790 ERROR grin_wallet::controller - finalize_tx: failed with error: LibTx Error
20181231 13:26:33.790 ERROR grin_wallet::controller - Request Error: Error { inner: 

LibTx Error }

Please use the following steps to reproduce:

run a grin server on address 0.0.0.0:13413
grin --floonet server run

set the owner_api key to "key"

Run a owner_api listener:
grin --floonet wallet -p dummy owner_api

Have a local wallet with some grin in it

have keybase server running and a user logged in

Run the test script:
./keybase_send_tx.py

where ./keybase_send_tx.py contains:

#!/usr/bin/env python3

import requests
import json
import sys

keybase_user = "qsaszs"
grin_owner_api_url = "http://localhost:13420"
wallet_auth = ("grin", "key")

def main():
    tx_send_url = grin_owner_api_url + "/v1/wallet/owner/issue_send_tx"
    data = {
            'method': 'keybase',
            'amount': 1230000000,
            'minimum_confirmations': 10,
            'dest': keybase_user,
            'max_outputs': 10,
            'num_change_outputs': 1,
            'selection_strategy_is_use_all': False,
            'fluff': False,
        }
    print("Command: {} {}".format(tx_send_url, data))
    r = requests.post(
            url=tx_send_url,
            data=json.dumps(data),
            auth=wallet_auth,
        )
    if not (r.status_code >= 200 and r.status_code < 300):
        print("Send failed with error {} : {}".format(r.status_code, r.reason))
        sys.exit(1)
    print("Sent OK: {} : {}".format(r.status_code, r.json()))


    # WARNING:  keybase send does not FINALIZE or POST the tx after, we need to do that manually

    tx_finalize_url = grin_owner_api_url + "/v1/wallet/owner/finalize_tx"
    print("Command: {}".format(tx_finalize_url))
    r = requests.post(
            url=tx_finalize_url,
            data=r.text,
            auth=wallet_auth,
        )
    if not (r.status_code >= 200 and r.status_code < 300):
        print("Finalize failed with error {} : {}".format(r.status_code, r.reason))
        sys.exit(1)
    print("Finalized OK: {} : {}".format(r.status_code, r.json()))


    tx_post_url = grin_owner_api_url + "/v1/wallet/owner/post_tx"
    print("Command: {}".format(tx_post_url))
    r = requests.post(
            url=tx_post_url,
            data=r.text,
            auth=wallet_auth
        )
    if not (r.status_code >= 200 and r.status_code < 300):
        print("Post failed with error {} : {}".format(r.status_code, r.reason))
        sys.exit(1)
    print("Posted OK: {} : {}".format(r.status_code, r.json()))


main()
@mcdallas
Copy link
Contributor

mcdallas commented Jan 1, 2019

} else if args.method == "keybase" {
let adapter = KeybaseWalletCommAdapter::new();
adapter.send_tx_sync(&args.dest, &slate)?;

the problem is there, it doesnt capture the response and it returns the original slate.

Tbh I don't know what such an api call should do exactly, should it return the slate or finalize? And the keybase response might take 60s to come back which leaves the http request hanging for 60s. Probably best to remove the method: keybase altogether from the api.

@garyyu
Copy link
Contributor

garyyu commented Jan 3, 2019

Close by #2278

@garyyu garyyu closed this as completed Jan 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants