Improve peers logic, fixed SQL error during peers dbSave #453

Merged
merged 5 commits into from Mar 2, 2017

Conversation

Projects
4 participants
@4miners
Member

4miners commented Mar 2, 2017

No description provided.

@karmacoma karmacoma self-assigned this Mar 2, 2017

@karmacoma karmacoma added this to Pending Review in Version 0.7.0 Mar 2, 2017

@coveralls

This comment has been minimized.

Show comment
Hide comment
@coveralls

coveralls Mar 2, 2017

Coverage Status

Coverage decreased (-7.8%) to 57.917% when pulling 5e6ed54 on 4miners:409_rewrite-peers-module into 7f92df6 on LiskHQ:409_rewrite-peers-module.

coveralls commented Mar 2, 2017

Coverage Status

Coverage decreased (-7.8%) to 57.917% when pulling 5e6ed54 on 4miners:409_rewrite-peers-module into 7f92df6 on LiskHQ:409_rewrite-peers-module.

@coveralls

This comment has been minimized.

Show comment
Hide comment
@coveralls

coveralls Mar 2, 2017

Coverage Status

Coverage decreased (-7.8%) to 57.917% when pulling 5e6ed54 on 4miners:409_rewrite-peers-module into 7f92df6 on LiskHQ:409_rewrite-peers-module.

Coverage Status

Coverage decreased (-7.8%) to 57.917% when pulling 5e6ed54 on 4miners:409_rewrite-peers-module into 7f92df6 on LiskHQ:409_rewrite-peers-module.

logic/peer.js
} else {
- this.ip = peer.ip;
+ this.ip = this.ip;

This comment has been minimized.

@MaciejBaj

MaciejBaj Mar 2, 2017

Member

by accident?

@MaciejBaj

MaciejBaj Mar 2, 2017

Member

by accident?

This comment has been minimized.

@4miners

4miners Mar 2, 2017

Member

Yep, thanks.

@4miners

4miners Mar 2, 2017

Member

Yep, thanks.

logic/peer.js
if (peer.dappid) {
if (Array.isArray(peer.dappid)) {
- this.dappid = peer.dappid;
+ peer.dappid = peer.dappid;

This comment has been minimized.

@MaciejBaj

MaciejBaj Mar 2, 2017

Member

by accident?

@MaciejBaj

MaciejBaj Mar 2, 2017

Member

by accident?

This comment has been minimized.

@4miners

4miners Mar 2, 2017

Member

Yep, thanks.

@4miners

4miners Mar 2, 2017

Member

Yep, thanks.

@coveralls

This comment has been minimized.

Show comment
Hide comment
@coveralls

coveralls Mar 2, 2017

Coverage Status

Coverage decreased (-0.4%) to 65.36% when pulling 995d215 on 4miners:409_rewrite-peers-module into 7f92df6 on LiskHQ:409_rewrite-peers-module.

coveralls commented Mar 2, 2017

Coverage Status

Coverage decreased (-0.4%) to 65.36% when pulling 995d215 on 4miners:409_rewrite-peers-module into 7f92df6 on LiskHQ:409_rewrite-peers-module.

@coveralls

This comment has been minimized.

Show comment
Hide comment
@coveralls

coveralls Mar 2, 2017

Coverage Status

Coverage decreased (-0.4%) to 65.36% when pulling 995d215 on 4miners:409_rewrite-peers-module into 7f92df6 on LiskHQ:409_rewrite-peers-module.

Coverage Status

Coverage decreased (-0.4%) to 65.36% when pulling 995d215 on 4miners:409_rewrite-peers-module into 7f92df6 on LiskHQ:409_rewrite-peers-module.

@coveralls

This comment has been minimized.

Show comment
Hide comment
@coveralls

coveralls Mar 2, 2017

Coverage Status

Coverage decreased (-0.4%) to 65.36% when pulling 995d215 on 4miners:409_rewrite-peers-module into 7f92df6 on LiskHQ:409_rewrite-peers-module.

Coverage Status

Coverage decreased (-0.4%) to 65.36% when pulling 995d215 on 4miners:409_rewrite-peers-module into 7f92df6 on LiskHQ:409_rewrite-peers-module.

@coveralls

This comment has been minimized.

Show comment
Hide comment
@coveralls

coveralls Mar 2, 2017

Coverage Status

Coverage decreased (-0.4%) to 65.36% when pulling 995d215 on 4miners:409_rewrite-peers-module into 7f92df6 on LiskHQ:409_rewrite-peers-module.

Coverage Status

Coverage decreased (-0.4%) to 65.36% when pulling 995d215 on 4miners:409_rewrite-peers-module into 7f92df6 on LiskHQ:409_rewrite-peers-module.

// Change value only when is defined, also prevent release ban when banned peer connect to our node
- if (value !== null && value !== undefined && !(key === 'state' && this.state === 0 && object.state === 2)) {
- this[key] = value;
+ if (peer[key] !== null && peer[key] !== undefined && !(key === 'state' && this.state === 0 && peer.state === 2) && !_.includes(self.immutable, key)) {

This comment has been minimized.

@MaciejBaj

MaciejBaj Mar 2, 2017

Member

so we cannot unset properties that were set before.

@MaciejBaj

MaciejBaj Mar 2, 2017

Member

so we cannot unset properties that were set before.

This comment has been minimized.

@MaciejBaj

MaciejBaj Mar 2, 2017

Member

are these 2 checks needed?

@MaciejBaj

MaciejBaj Mar 2, 2017

Member

are these 2 checks needed?

This comment has been minimized.

@MaciejBaj

MaciejBaj Mar 2, 2017

Member

ok as we discussed- let's leave it as it is

@MaciejBaj

MaciejBaj Mar 2, 2017

Member

ok as we discussed- let's leave it as it is

+
+ // Accept only supported and defined properties
+ _.each(self.properties, function (key) {
+ if (peer[key] !== null && peer[key] !== undefined) {

This comment has been minimized.

@MaciejBaj

MaciejBaj Mar 2, 2017

Member

also here, why we won't let to unset properties?

@MaciejBaj

MaciejBaj Mar 2, 2017

Member

also here, why we won't let to unset properties?

This comment has been minimized.

@MaciejBaj

MaciejBaj Mar 2, 2017

Member

ok as we discussed- let's leave it as it is

@MaciejBaj

MaciejBaj Mar 2, 2017

Member

ok as we discussed- let's leave it as it is

@coveralls

This comment has been minimized.

Show comment
Hide comment
@coveralls

coveralls Mar 2, 2017

Coverage Status

Coverage decreased (-0.4%) to 65.351% when pulling 5d9d664 on 4miners:409_rewrite-peers-module into 7f92df6 on LiskHQ:409_rewrite-peers-module.

coveralls commented Mar 2, 2017

Coverage Status

Coverage decreased (-0.4%) to 65.351% when pulling 5d9d664 on 4miners:409_rewrite-peers-module into 7f92df6 on LiskHQ:409_rewrite-peers-module.

@coveralls

This comment has been minimized.

Show comment
Hide comment
@coveralls

coveralls Mar 2, 2017

Coverage Status

Coverage decreased (-0.4%) to 65.351% when pulling 5d9d664 on 4miners:409_rewrite-peers-module into 7f92df6 on LiskHQ:409_rewrite-peers-module.

Coverage Status

Coverage decreased (-0.4%) to 65.351% when pulling 5d9d664 on 4miners:409_rewrite-peers-module into 7f92df6 on LiskHQ:409_rewrite-peers-module.

@coveralls

This comment has been minimized.

Show comment
Hide comment
@coveralls

coveralls Mar 2, 2017

Coverage Status

Coverage decreased (-0.4%) to 65.351% when pulling 5d9d664 on 4miners:409_rewrite-peers-module into 7f92df6 on LiskHQ:409_rewrite-peers-module.

Coverage Status

Coverage decreased (-0.4%) to 65.351% when pulling 5d9d664 on 4miners:409_rewrite-peers-module into 7f92df6 on LiskHQ:409_rewrite-peers-module.

@coveralls

This comment has been minimized.

Show comment
Hide comment
@coveralls

coveralls Mar 2, 2017

Coverage Status

Coverage decreased (-0.4%) to 65.351% when pulling 5d9d664 on 4miners:409_rewrite-peers-module into 7f92df6 on LiskHQ:409_rewrite-peers-module.

Coverage Status

Coverage decreased (-0.4%) to 65.351% when pulling 5d9d664 on 4miners:409_rewrite-peers-module into 7f92df6 on LiskHQ:409_rewrite-peers-module.

@coveralls

This comment has been minimized.

Show comment
Hide comment
@coveralls

coveralls Mar 2, 2017

Coverage Status

Coverage decreased (-0.4%) to 65.351% when pulling 5d9d664 on 4miners:409_rewrite-peers-module into 7f92df6 on LiskHQ:409_rewrite-peers-module.

Coverage Status

Coverage decreased (-0.4%) to 65.351% when pulling 5d9d664 on 4miners:409_rewrite-peers-module into 7f92df6 on LiskHQ:409_rewrite-peers-module.

MaciejBaj added some commits Mar 2, 2017

@karmacoma karmacoma merged commit e827053 into LiskHQ:409_rewrite-peers-module Mar 2, 2017

1 of 2 checks passed

coverage/coveralls Coverage decreased (-0.03%) to 65.713%
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@karmacoma karmacoma moved this from Pending Review to Done in Version 0.7.0 Mar 2, 2017

@4miners 4miners deleted the 4miners:409_rewrite-peers-module branch Mar 6, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment