Add support for NullData addresses (OP_RETURN)

This commit is contained in:
Steven Roose 2018-12-11 13:24:44 +01:00
parent 18ee3417d8
commit ac1eadd0de
4 changed files with 41 additions and 1 deletions

View file

@ -177,6 +177,11 @@ bool ExtractDestination(const CScript& scriptPubKey, CTxDestination& addressRet)
if (!Solver(scriptPubKey, whichType, vSolutions))
return false;
if (whichType == TX_NULL_DATA) {
// This is data, not addresses
return false;
}
if (whichType == TX_PUBKEY)
{
CPubKey pubKey(vSolutions[0]);
@ -303,6 +308,16 @@ public:
*script << CScript::EncodeOP_N(id.version) << std::vector<unsigned char>(id.program, id.program + id.length);
return true;
}
bool operator()(const NullData& id) const
{
script->clear();
*script << OP_RETURN;
for (const auto& push : id.null_data) {
*script << push;
}
return true;
}
};
} // namespace