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

txref BIP needs pull request for txos #4

Closed
dcdpr opened this issue Jun 4, 2018 · 3 comments
Closed

txref BIP needs pull request for txos #4

dcdpr opened this issue Jun 4, 2018 · 3 comments

Comments

@dcdpr
Copy link
Owner

dcdpr commented Jun 4, 2018

No description provided.

@dcdpr
Copy link
Owner Author

dcdpr commented Jun 4, 2018

PR should include a reference classifyInputString().

@dcdpr
Copy link
Owner Author

dcdpr commented Jun 29, 2018

Our current proposed text surrounding classifyInputString() is as follows:

Among input strings that are well formed bech32 strings, the
following two length checks may be used to discriminate between
txref and txrefext inputs:

const int TXREF_STRING_MIN_LENGTH = 17;              // ex: "tx1rqqqqqqqqmhuqk"
const int TXREF_EXT_STRING_MIN_LENGTH = 20;          // ex: "tx1rqqqqqqqqqquau7hl"
const int TXREF_STRING_MIN_LENGTH_TESTNET = 23;      // ex: "txtest1xqqqqqqqqqkn3gh9"
const int TXREF_EXT_STRING_MIN_LENGTH_TESTNET = 26;  // ex: "txtest1xqqqqqqqqqqqqj7dvzy"

enum InputParam { unknown_param, txref_param, txrefext_param };

// before testing for various txrefs, get rid of any unknown characters
std::string s = bech32::stripUnknownChars(str);

if(s.length() == TXREF_STRING_MIN_LENGTH ||
   s.length() == TXREF_STRING_MIN_LENGTH_TESTNET) {
    return txref_param;
}

if(s.length() == TXREF_EXT_STRING_MIN_LENGTH ||
   s.length() == TXREF_EXT_STRING_MIN_LENGTH_TESTNET) {
    return txrefext_param;
}

return unknown_param;

Example in context

@rxgrant
Copy link
Collaborator

rxgrant commented Nov 30, 2018

@rxgrant rxgrant closed this as completed Nov 30, 2018
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

2 participants