| 4703 | } |
| 4704 | |
| 4705 | CTxDestination CWallet::AddAndGetDestinationForScript(const CScript& script, OutputType type) |
| 4706 | { |
| 4707 | // Note that scripts over 520 bytes are not yet supported. |
| 4708 | switch (type) { |
| 4709 | case OUTPUT_TYPE_LEGACY: |
| 4710 | return CScriptID(script); |
| 4711 | case OUTPUT_TYPE_P2SH_SEGWIT: |
| 4712 | case OUTPUT_TYPE_BECH32: { |
| 4713 | WitnessV0ScriptHash hash; |
| 4714 | CSHA256().Write(&script[0], script.size()).Finalize(hash.begin()); |
| 4715 | CTxDestination witdest = hash; |
| 4716 | CScript witprog = GetScriptForDestination(witdest); |
| 4717 | // Check if the resulting program is solvable (i.e. doesn't use an uncompressed key) |
| 4718 | if (!IsSolvable(*this, witprog)) return CScriptID(script); |
| 4719 | // Add the redeemscript, so that P2WSH and P2SH-P2WSH outputs are recognized as ours. |
| 4720 | AddCScript(witprog); |
| 4721 | if (type == OUTPUT_TYPE_BECH32) { |
| 4722 | return witdest; |
| 4723 | } else { |
| 4724 | return CScriptID(witprog); |
| 4725 | } |
| 4726 | } |
| 4727 | default: assert(false); |
| 4728 | } |
| 4729 | } |
| 4730 | bool CWallet::SetContractBook(const string &strAddress, const string &strName, const string &strAbi) |
| 4731 | { |
| 4732 | bool fUpdated = false; |
no test coverage detected