diff --git a/conduit/plugins/exporters/postgresql/postgresql_exporter.go b/conduit/plugins/exporters/postgresql/postgresql_exporter.go index d6799295..feaba9f2 100644 --- a/conduit/plugins/exporters/postgresql/postgresql_exporter.go +++ b/conduit/plugins/exporters/postgresql/postgresql_exporter.go @@ -3,6 +3,7 @@ package postgresql import ( "context" _ "embed" // used to embed config + "errors" "fmt" "sync" "sync/atomic" @@ -26,6 +27,8 @@ import ( // PluginName to use when configuring. const PluginName = "postgresql" +var errMissingDelta = errors.New("ledger state delta is missing from block, ensure algod importer is using 'follower' mode") + type postgresqlExporter struct { round uint64 cfg ExporterConfig @@ -120,7 +123,7 @@ func (exp *postgresqlExporter) Receive(exportData data.BlockData) error { if exportData.Round() == 0 { exportData.Delta = &sdk.LedgerStateDelta{} } else { - return fmt.Errorf("receive got an invalid block: %#v", exportData) + return errMissingDelta } } // Do we need to test for consensus protocol here? diff --git a/conduit/plugins/exporters/postgresql/postgresql_exporter_test.go b/conduit/plugins/exporters/postgresql/postgresql_exporter_test.go index fbab3c96..22085220 100644 --- a/conduit/plugins/exporters/postgresql/postgresql_exporter_test.go +++ b/conduit/plugins/exporters/postgresql/postgresql_exporter_test.go @@ -2,7 +2,6 @@ package postgresql import ( "context" - "fmt" "testing" "github.com/sirupsen/logrus" @@ -80,8 +79,8 @@ func TestReceiveInvalidBlock(t *testing.T) { Certificate: &map[string]interface{}{}, Delta: nil, } - expectedErr := fmt.Sprintf("receive got an invalid block: %#v", invalidBlock) - assert.EqualError(t, pgsqlExp.Receive(invalidBlock), expectedErr) + err := pgsqlExp.Receive(invalidBlock) + assert.ErrorIs(t, err, errMissingDelta) } func TestReceiveAddBlockSuccess(t *testing.T) {