function isReplaceNeeded(originalBlockchain, newBlockchain) { /** * TODO: the haviest chain rule. * The current implementation is the longest chain rule. */ if (originalBlockchain.length < newBlockchain.length) { return true; } else if (originalBlockchain.length > newBlockchain.length) { return false; } else { return boolean(); } }