Commit ecd109a8 authored by Adrien Béraud's avatar Adrien Béraud

nodejs: trim address string

Recent Web3 versions are more restrictive and don't
accept trailing whitespace or newlines.
Trim String address before giving them to Web3.

Change-Id: I32dc963247af4b71182b4f0b5862bfabcc588c89
parent d3bf04af
......@@ -94,7 +94,7 @@ function loadContract() {
if (err) {
console.log("Can't read contract address: " + err);
} else {
regAddress = String(content);
regAddress = String(content).trim();
}
fs.readFile(REG_FILE, function(err, data){
if (err)
......@@ -178,8 +178,9 @@ function parseString(s) {
return s ? web3.toUtf8(s) : s;
}
function formatAddress(s) {
if (s) {
function formatAddress(address) {
if (address) {
var s = address.trim();
try {
if (s.startsWith("ring:"))
s = s.substr(5);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment