| 384 | } |
| 385 | |
| 386 | std::string CScript::ToString() const |
| 387 | { |
| 388 | std::string str; |
| 389 | opcodetype opcode; |
| 390 | std::vector<unsigned char> vch; |
| 391 | const_iterator pc = begin(); |
| 392 | while (pc < end()) |
| 393 | { |
| 394 | if (!str.empty()) |
| 395 | str += " "; |
| 396 | if (!GetOp(pc, opcode, vch)) |
| 397 | { |
| 398 | str += "[error]"; |
| 399 | return str; |
| 400 | } |
| 401 | if (0 <= opcode && opcode <= OP_PUSHDATA4) |
| 402 | str += ValueString(vch); |
| 403 | else |
| 404 | str += GetOpName(opcode); |
| 405 | } |
| 406 | return str; |
| 407 | } |
| 408 | |
| 409 | std::string CScriptWitness::ToString() const |
| 410 | { |