Skip to content

Commit

Permalink
Merge pull request nervosnetwork#469 from jjyr/fix-peer-store-unique
Browse files Browse the repository at this point in the history
fix: PeerStore unique constraint failed
  • Loading branch information
doitian committed Apr 14, 2019
2 parents e70407c + febcae0 commit ac79f50
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion network/src/peer_store/sqlite/db.rs
Expand Up @@ -67,7 +67,7 @@ impl PeerInfo {
last_connected_at: Duration,
) -> DBResult<usize> {
let network_group = connected_addr.network_group();
let mut stmt = conn.prepare("INSERT INTO peer_info (peer_id, connected_addr, score, status, endpoint, last_connected_at, network_group, ban_time)
let mut stmt = conn.prepare("INSERT OR REPLACE INTO peer_info (peer_id, connected_addr, score, status, endpoint, last_connected_at, network_group, ban_time)
VALUES(:peer_id, :connected_addr, :score, :status, :endpoint, :last_connected_at, :network_group, 0)").expect("prepare");
stmt.execute_named(&[
(":peer_id", &peer_id.as_bytes()),
Expand Down

0 comments on commit ac79f50

Please sign in to comment.