Update cloud.js
Added ethereum address handling for decodeID function
This commit is contained in:
parent
6a57aa1273
commit
36d15bd7f8
@ -3,6 +3,8 @@
|
|||||||
function K_Bucket(masterID, nodeList) {
|
function K_Bucket(masterID, nodeList) {
|
||||||
|
|
||||||
const decodeID = function (floID) {
|
const decodeID = function (floID) {
|
||||||
|
if (floID.startsWith("0x") || floID.length === '40')
|
||||||
|
floID = proxyID(floID);
|
||||||
let k = bitjs.Base58.decode(floID);
|
let k = bitjs.Base58.decode(floID);
|
||||||
k.shift();
|
k.shift();
|
||||||
k.splice(-4, 4);
|
k.splice(-4, 4);
|
||||||
@ -110,7 +112,7 @@ function proxyID(address) {
|
|||||||
});
|
});
|
||||||
hash[0] != checksum[0] || hash[1] != checksum[1] || hash[2] != checksum[2] || hash[3] != checksum[3] ?
|
hash[0] != checksum[0] || hash[1] != checksum[1] || hash[2] != checksum[2] || hash[3] != checksum[3] ?
|
||||||
bytes = undefined : bytes.shift();
|
bytes = undefined : bytes.shift();
|
||||||
} else if (address.length == 42 || address.length == 62) { //bech encoding
|
} else if (!address.startsWith("0x") && (address.length == 42 || address.length == 62)) { //bech encoding
|
||||||
if (typeof coinjs !== 'function')
|
if (typeof coinjs !== 'function')
|
||||||
throw "library missing (lib_btc.js)";
|
throw "library missing (lib_btc.js)";
|
||||||
let decode = coinjs.bech32_decode(address);
|
let decode = coinjs.bech32_decode(address);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user