From 5a26dba8e55b8e55119c65d6f9860eca8c9b21ca Mon Sep 17 00:00:00 2001 From: frrist Date: Wed, 22 Jul 2020 16:47:47 -0700 Subject: [PATCH] fix: handle reorgs for id mapping table --- cmd/lotus-chainwatch/processor/common_actors.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmd/lotus-chainwatch/processor/common_actors.go b/cmd/lotus-chainwatch/processor/common_actors.go index 81caf666b..3baad612d 100644 --- a/cmd/lotus-chainwatch/processor/common_actors.go +++ b/cmd/lotus-chainwatch/processor/common_actors.go @@ -207,7 +207,8 @@ create temp table iam (like id_address_map excluding constraints) on commit drop return err } - if _, err := tx.Exec(`insert into id_address_map select * from iam on conflict do nothing `); err != nil { + // HACK until chain watch can handle reorgs we need to update this table when ID -> PubKey mappings change + if _, err := tx.Exec(`insert into id_address_map select * from iam on conflict (id) do update set address = EXCLUDED.address`); err != nil { return xerrors.Errorf("actor put: %w", err) }