Skip to content

Commit f6a6e8f

Browse files
committed
Return address prefix
1 parent a641070 commit f6a6e8f

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

src/main.cc

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,19 @@ Handle<Value> except(const char* msg) {
1919
return ThrowException(Exception::Error(String::New(msg)));
2020
}
2121

22+
blobdata uint64be_to_blob(uint64_t num) {
23+
blobdata res = " ";
24+
res[0] = num >> 56 & 0xff;
25+
res[1] = num >> 48 & 0xff;
26+
res[2] = num >> 40 & 0xff;
27+
res[3] = num >> 32 & 0xff;
28+
res[4] = num >> 24 & 0xff;
29+
res[5] = num >> 16 & 0xff;
30+
res[6] = num >> 8 & 0xff;
31+
res[7] = num & 0xff;
32+
return res;
33+
}
34+
2235
Handle<Value> convert_blob(const Arguments& args) {
2336
HandleScope scope;
2437

@@ -65,6 +78,8 @@ Handle<Value> address_decode(const Arguments& args) {
6578

6679
tools::base58::decode_addr(input, prefix, output);
6780

81+
output = uint64be_to_blob(prefix) + output;
82+
6883
Buffer* buff = Buffer::New(output.data(), output.size());
6984
return scope.Close(buff->handle_);
7085
}

0 commit comments

Comments
 (0)