getrawtransaction: scriptpubkey type is 'fee'

This commit is contained in:
Gregory Sanders 2017-02-28 15:42:39 -08:00
parent 8c15763b7f
commit f86b32e80d
3 changed files with 9 additions and 5 deletions

View file

@ -129,10 +129,7 @@ void TxToJSON(const CTransaction& tx, const uint256 hashBlock, UniValue& entry)
const CTxOut& txout = tx.vout[i];
UniValue out(UniValue::VOBJ);
if (txout.nValue.IsAmount())
if (txout.IsFee())
out.push_back(Pair("fee_value", ValueFromAmount(txout.nValue.GetAmount())));
else
out.push_back(Pair("value", ValueFromAmount(txout.nValue.GetAmount())));
out.push_back(Pair("value", ValueFromAmount(txout.nValue.GetAmount())));
else {
int exp;
int mantissa;

View file

@ -35,6 +35,7 @@ const char* GetTxnOutputType(txnouttype t)
case TX_WITNESS_V0_SCRIPTHASH: return "witness_v0_scripthash";
case TX_WITHDRAW_LOCK: return "withdraw";
case TX_TRUE: return "true";
case TX_FEE: return "fee";
}
return NULL;
}
@ -70,6 +71,11 @@ bool Solver(const CScript& scriptPubKey, txnouttype& typeRet, vector<vector<unsi
return true;
}
if (scriptPubKey == CScript()) {
typeRet = TX_FEE;
return true;
}
int witnessversion;
std::vector<unsigned char> witnessprogram;
if (scriptPubKey.IsWitnessProgram(witnessversion, witnessprogram)) {
@ -229,7 +235,7 @@ bool ExtractDestinations(const CScript& scriptPubKey, txnouttype& typeRet, vecto
vector<valtype> vSolutions;
if (!Solver(scriptPubKey, typeRet, vSolutions))
return false;
if (typeRet == TX_NULL_DATA || typeRet == TX_WITHDRAW_LOCK){
if (typeRet == TX_NULL_DATA || typeRet == TX_WITHDRAW_LOCK || typeRet == TX_FEE){
// This is data, not addresses
return false;
}

View file

@ -55,6 +55,7 @@ enum txnouttype
TX_WITNESS_V0_KEYHASH,
TX_WITHDRAW_LOCK,
TX_TRUE,
TX_FEE,
};
class CNoDestination {