-
Notifications
You must be signed in to change notification settings - Fork 716
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
getspentzerocoinamount RPC call. #385
getspentzerocoinamount RPC call. #385
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works as expected for me. Few minor changes requested.
src/rpcrawtransaction.cpp
Outdated
if (!input.scriptSig.IsZerocoinSpend()) | ||
return -1; | ||
|
||
std::vector<char, zero_after_free_allocator<char> > dataTxIn; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can simplify this code:
libzerocoin::CoinSpend spend = TxInToZerocoinSpend(input);
src/rpcrawtransaction.cpp
Outdated
dataTxIn.insert(dataTxIn.end(), input.scriptSig.begin() + 4, input.scriptSig.end()); | ||
CDataStream serializedCoinSpend(dataTxIn, SER_NETWORK, PROTOCOL_VERSION); | ||
libzerocoin::CoinSpend spend(Params().Zerocoin_Params(), serializedCoinSpend); | ||
return libzerocoin::ZerocoinDenominationToAmount(spend.getDenomination()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should return the formatted version of the value. Most people have a hard time figuring out pivtoshis.
CAmount nValue = libzerocoin::ZerocoinDenominationToAmount(spend.getDenomination());
return FormatMoney(nValue);
Implemented requested changes |
Accepts transaction hash and input index as parameters and returns amount of spent zerocoin input (if input is not zerocoin spend, returns -1). Return value in pivs, not pivtoshis.
3e42806
to
0c38407
Compare
Rebased/Squashed into a single commit for merging |
0c38407 Add getspentzerocoinamount RPC call (whateverpal) Tree-SHA512: 25222e480697db965cb762ff3ce26a28d3e07b3b03bfe0a7d82aeed40ca43ea7af81c827586896a82ab0cc02027e6ae2226ae73510b7ad49e17292099c2720da
Accepts transaction hash and input index as parameters and returns amount of spent zerocoin input (if input is not zerocoin spend, returns -1). Return value in pivs, not pivtoshis. Github-Merge: PIVX-Project#385 Rebased-From: 0c38407
Accepts transaction hash and input index as parameters and returns amount of spent zerocoin input (if input is not zerocoin spend, returns -1). Return value in pivs, not pivtoshis. Github-Merge: PIVX-Project#385 Rebased-From: 0c38407
Accepts transaction hash and input index as parameters and returns amount of spent zerocoin input (if input is not zerocoin spend, returns -1). Return value in pivs, not pivtoshis. Github-Merge: PIVX-Project#385 Rebased-From: 0c38407
Accepts transaction hash and input index as parameters and returns amount of spent zerocoin input (if input is not zerocoin spend, returns -1).