Fix messages example

This commit is contained in:
Kagami Hiiragi 2015-02-24 21:21:42 +03:00
parent ecf2931aad
commit 1082fc708a
2 changed files with 4 additions and 6 deletions

View File

@ -119,9 +119,8 @@ var addrPayload = messages.addr.encodePayload([
var addrmsg = structs.message.encode("addr", addrPayload);
var decoded = structs.message.decode(addrmsg);
console.log(decoded.command); // addr
var payload = decoded.payload;
var decodedPayload = messages.addr.decodePayload(payload);
console.log(decodedPayload.addrs[0].host); // 2.2.2.2
var addr = messages.addr.decodePayload(decoded.payload);
console.log(addr.addrs[0].host); // 2.2.2.2
// Encode with empty payload:
var verackmsg = structs.message.encode("verack");

View File

@ -22,9 +22,8 @@
* var addrmsg = structs.message.encode("addr", addrPayload);
* var decoded = structs.message.decode(addrmsg);
* console.log(decoded.command); // addr
* var payload = decoded.payload;
* var decodedPayload = messages.addr.decodePayload(payload);
* console.log(decodedPayload.addrs[0].host); // 2.2.2.2
* var addr = messages.addr.decodePayload(decoded.payload);
* console.log(addr.addrs[0].host); // 2.2.2.2
*
* // Encode with empty payload:
* var verackmsg = structs.message.encode("verack");