mastercoin-MSC / mastercore

mastercore info
mastercoin.org
MIT License
24 stars 11 forks source link

Replace: CScript::mscore_getHex() and CScript::mscore_parse() #266

Closed dexX7 closed 9 years ago

dexX7 commented 9 years ago

There was exactly one use of CScript::mscore_getHex(), so it was replaced to reduce the impact on Bitcoin Core. Instead of using a modified version of CScript::ToString(), CScript::mscore_parse() was replaced by an external function, which collects pushed values in a script.

The original state of script.h is now contained.

Build confirmation: https://travis-ci.org/dexX7/mastercore/builds/45404574

The other friends on TODO: GetScriptForDestination(), GetScriptForMultisig() and maybe GetDustLimit().

dexX7 commented 9 years ago

My private branch has:

#if CLIENT_VERSION_MINOR < 10
  #include "key.h"
  #include "script.h"
#elif CLIENT_VERSION_MINOR == 10
  #include "pubkey.h"
  #include "script/script.h"
  #include "script/standard.h"
#endif

#if CLIENT_VERSION_MINOR < 10
CScript GetScriptForMultisig(int nRequired, const std::vector<CPubKey>& keys)
{
    CScript script;
    script.SetMultisig(nRequired, keys);

    return script;
}

CScript GetScriptForDestination(const CTxDestination& dest)
{
    CScript script;
    script.SetDestination(dest);

    return script;
}
#endif

... but it's really a question whether an upgrade or downgrade (from 0.10 to 0.9 and vice versa) should be aimed for.

Background: 0.10 doesn't have Script::SetDestination anymore, but Script::GetScriptForDestination.

Edit: nevertheless, I think it should be aimed for. But I will withhold such changes for now, unless it gets green light.

dexX7 commented 9 years ago

Became part of https://github.com/mastercoin-MSC/mastercore/issues/286#issuecomment-77524801.