From f6a6e8fd34601e223aeaffc238472578da79c572 Mon Sep 17 00:00:00 2001 From: lucas Date: Sat, 17 May 2014 17:46:58 +0100 Subject: [PATCH] Return address prefix --- src/main.cc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/main.cc b/src/main.cc index 6c6e51d..6e8f8a7 100644 --- a/src/main.cc +++ b/src/main.cc @@ -19,6 +19,19 @@ Handle except(const char* msg) { return ThrowException(Exception::Error(String::New(msg))); } +blobdata uint64be_to_blob(uint64_t num) { + blobdata res = " "; + res[0] = num >> 56 & 0xff; + res[1] = num >> 48 & 0xff; + res[2] = num >> 40 & 0xff; + res[3] = num >> 32 & 0xff; + res[4] = num >> 24 & 0xff; + res[5] = num >> 16 & 0xff; + res[6] = num >> 8 & 0xff; + res[7] = num & 0xff; + return res; +} + Handle convert_blob(const Arguments& args) { HandleScope scope; @@ -65,6 +78,8 @@ Handle address_decode(const Arguments& args) { tools::base58::decode_addr(input, prefix, output); + output = uint64be_to_blob(prefix) + output; + Buffer* buff = Buffer::New(output.data(), output.size()); return scope.Close(buff->handle_); }