Example #1
0
 UniValue operator()(const WitnessV0ScriptHash& id) const
 {
     UniValue obj(UniValue::VOBJ);
     obj.pushKV("isscript", true);
     obj.pushKV("iswitness", true);
     obj.pushKV("witness_version", 0);
     obj.pushKV("witness_program", HexStr(id.begin(), id.end()));
     return obj;
 }
Example #2
0
 UniValue operator()(const WitnessV0ScriptHash& id) const
 {
     UniValue obj(UniValue::VOBJ);
     CScript subscript;
     obj.push_back(Pair("isscript", true));
     obj.push_back(Pair("iswitness", true));
     obj.push_back(Pair("witness_version", 0));
     obj.push_back(Pair("witness_program", HexStr(id.begin(), id.end())));
     CRIPEMD160 hasher;
     uint160 hash;
     hasher.Write(id.begin(), 32).Finalize(hash.begin());
     if (pwallet && pwallet->GetCScript(CScriptID(hash), subscript)) {
         obj.push_back(Pair("hex", HexStr(subscript.begin(), subscript.end())));
     }
     return obj;
 }