Merge pull request #2538 from filecoin-project/fix/chainwatch-id-table-reorgs

fix: handle reorgs for id mapping table
This commit is contained in:
Łukasz Magiera 2020-07-23 10:18:39 +02:00 committed by GitHub
commit 78f7a96300
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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)
}