diff --git a/config/config.go b/config/config.go index 81b9b47a..45b5266a 100644 --- a/config/config.go +++ b/config/config.go @@ -61,6 +61,9 @@ type Config struct { InfuraProjectID string EtherscanAPIKey string + // Exchange price monitoring + RunExchangePriceMonitoring bool + // Emails SendgridApiKey string SendgridDomain string @@ -168,6 +171,9 @@ func LoadConfig(coreConfig *coreCmd.Config) *Config { // Etherscan API Key config.EtherscanAPIKey = viper.GetString("etherscan-api-key") + // Exchange price monitoring + config.RunExchangePriceMonitoring = viper.GetBool("run-exchange-price-monitoring") + // Seed from which DeSo will be sent for orders placed through Wyre and "Buy With BTC" purchases config.BuyDESOSeed = viper.GetString("buy-deso-seed") diff --git a/routes/post.go b/routes/post.go index 4011b435..9b881fb3 100644 --- a/routes/post.go +++ b/routes/post.go @@ -1176,6 +1176,8 @@ func (fes *APIServer) GetPostsHashHexList(ww http.ResponseWriter, req *http.Requ postEntryResponses = append(postEntryResponses, postEntryResponse) + postEntryResponse.PostEntryReaderState = utxoView.GetPostEntryReaderState(readerPublicKeyBytes, postEntry) + } if requestData.OrderBy == "newest" { diff --git a/routes/server.go b/routes/server.go index 8c16761a..7ebc001f 100644 --- a/routes/server.go +++ b/routes/server.go @@ -526,18 +526,21 @@ func NewAPIServer( fes.StartSeedBalancesMonitoring() - // Call this once upon starting server to ensure we have a good initial value - fes.UpdateUSDCentsToDeSoExchangeRate() - fes.UpdateUSDToBTCPrice() - fes.UpdateUSDToETHPrice() // Get the transaction fee map from global state if it exists fes.TransactionFeeMap = fes.GetTransactionFeeMapFromGlobalState() fes.ExemptPublicKeyMap = fes.GetExemptPublicKeyMapFromGlobalState() - // Then monitor them - fes.StartExchangePriceMonitoring() + if fes.Config.RunExchangePriceMonitoring { + // Call this once upon starting server to ensure we have a good initial value + fes.UpdateUSDCentsToDeSoExchangeRate() + fes.UpdateUSDToBTCPrice() + fes.UpdateUSDToETHPrice() + + // Then monitor them + fes.StartExchangePriceMonitoring() + } if fes.Config.RunHotFeedRoutine { fes.StartHotFeedRoutine() diff --git a/routes/shared.go b/routes/shared.go index c050007c..3cd409bc 100644 --- a/routes/shared.go +++ b/routes/shared.go @@ -263,14 +263,15 @@ func (fes *APIServer) GetVerifiedUsernameToPKIDMapFromGlobalState() (_verificati verifiedMapStruct.VerifiedUsernameToPKID = make(map[string]*lib.PKID) // Encode the map and stick it in the database. - metadataDataBuf := bytes.NewBuffer([]byte{}) - if err = gob.NewEncoder(metadataDataBuf).Encode(verifiedMapStruct); err != nil { - return nil, fmt.Errorf("GetVerifiedUsernameToPKIDMapFromGlobalState: cannot encode verifiedMap struct: %v", err) - } - err = fes.GlobalState.Put(_GlobalStatePrefixForVerifiedMap, metadataDataBuf.Bytes()) - if err != nil { - return nil, fmt.Errorf("GetVerifiedUsernameToPKIDMapFromGlobalState: Cannot Decode Verification Map: %v", err) - } + // TODO: Disabled code below because it was causing a blank verifiedusername map. We should investigate why. + // metadataDataBuf := bytes.NewBuffer([]byte{}) + // if err = gob.NewEncoder(metadataDataBuf).Encode(verifiedMapStruct); err != nil { + // return nil, fmt.Errorf("GetVerifiedUsernameToPKIDMapFromGlobalState: cannot encode verifiedMap struct: %v", err) + // } + // err = fes.GlobalState.Put(_GlobalStatePrefixForVerifiedMap, metadataDataBuf.Bytes()) + // if err != nil { + // return nil, fmt.Errorf("GetVerifiedUsernameToPKIDMapFromGlobalState: Cannot Decode Verification Map: %v", err) + // } } // Return the verificationMap return verifiedMapStruct.VerifiedUsernameToPKID, nil