From 7c36903093a391c0977899b9a0efb48f87a4442e Mon Sep 17 00:00:00 2001 From: Lazy Nina <> Date: Fri, 5 Jan 2024 16:14:54 -0500 Subject: [PATCH] Remove fee estimator from txn construction calls --- routes/access_group.go | 6 ++---- routes/admin_transaction.go | 4 ++-- routes/associations.go | 4 ---- routes/exchange.go | 15 +++++++------- routes/message.go | 6 ++---- routes/new_message.go | 2 +- routes/nft.go | 21 +++++++------------ routes/server.go | 2 +- routes/shared.go | 3 +-- routes/transaction.go | 41 +++++++++++++------------------------ routes/user.go | 6 +++--- routes/validators.go | 2 -- 12 files changed, 41 insertions(+), 71 deletions(-) diff --git a/routes/access_group.go b/routes/access_group.go index 873f3d01..6a5b7278 100644 --- a/routes/access_group.go +++ b/routes/access_group.go @@ -117,8 +117,7 @@ func (fes *APIServer) accessGroupHandler( accessGroupOwnerPkBytes, accessGroupPkBytes, accessGroupKeyNameBytes, accessGroupOperationType, extraData, - requestData.MinFeeRateNanosPerKB, fes.backendServer.GetMempool(), additionalOutputs, - fes.backendServer.GetFeeEstimator()) + requestData.MinFeeRateNanosPerKB, fes.backendServer.GetMempool(), additionalOutputs) if err != nil { return fmt.Errorf("problem creating transaction: %v", err) } @@ -398,8 +397,7 @@ func (fes *APIServer) accessGroupMemberHandler( accessGroupOwnerPkBytes, accessGroupKeyNameBytes, accessGroupMembers, accessGroupMemberOperationType, extraData, - requestData.MinFeeRateNanosPerKB, fes.backendServer.GetMempool(), additionalOutputs, - fes.backendServer.GetFeeEstimator()) + requestData.MinFeeRateNanosPerKB, fes.backendServer.GetMempool(), additionalOutputs) if err != nil { return fmt.Errorf("problem creating transaction: %v", err) } diff --git a/routes/admin_transaction.go b/routes/admin_transaction.go index 7b2f5277..4f6bbceb 100644 --- a/routes/admin_transaction.go +++ b/routes/admin_transaction.go @@ -273,7 +273,7 @@ func (fes *APIServer) UpdateGlobalParams(ww http.ResponseWriter, req *http.Reque maxNonceExpirationBlockHeightOffset, extraData, requestData.MinFeeRateNanosPerKB, - fes.backendServer.GetMempool(), additionalOutputs, fes.backendServer.GetFeeEstimator()) + fes.backendServer.GetMempool(), additionalOutputs) if err != nil { _AddBadRequestError(ww, fmt.Sprintf("UpdateGlobalParams: Problem creating transaction: %v", err)) return @@ -401,7 +401,7 @@ func (fes *APIServer) SwapIdentity(ww http.ResponseWriter, req *http.Request) { toPublicKey, requestData.MinFeeRateNanosPerKB, - fes.backendServer.GetMempool(), additionalOutputs, fes.backendServer.GetFeeEstimator()) + fes.backendServer.GetMempool(), additionalOutputs) if err != nil { _AddBadRequestError(ww, fmt.Sprintf("SwapIdentity: Problem creating transaction: %v", err)) return diff --git a/routes/associations.go b/routes/associations.go index 23f88b5e..14c9f9b7 100644 --- a/routes/associations.go +++ b/routes/associations.go @@ -252,7 +252,6 @@ func (fes *APIServer) CreateUserAssociation(ww http.ResponseWriter, req *http.Re requestData.MinFeeRateNanosPerKB, fes.backendServer.GetMempool(), additionalOutputs, - fes.backendServer.GetFeeEstimator(), ) if err != nil { _AddInternalServerError(ww, fmt.Sprintf("CreateUserAssociation: problem creating txn: %v", err)) @@ -338,7 +337,6 @@ func (fes *APIServer) DeleteUserAssociation(ww http.ResponseWriter, req *http.Re requestData.MinFeeRateNanosPerKB, fes.backendServer.GetMempool(), additionalOutputs, - fes.backendServer.GetFeeEstimator(), ) if err != nil { _AddInternalServerError(ww, fmt.Sprintf("DeleteUserAssociation: problem creating txn: %v", err)) @@ -806,7 +804,6 @@ func (fes *APIServer) CreatePostAssociation(ww http.ResponseWriter, req *http.Re requestData.MinFeeRateNanosPerKB, fes.backendServer.GetMempool(), additionalOutputs, - fes.backendServer.GetFeeEstimator(), ) if err != nil { _AddInternalServerError(ww, fmt.Sprintf("CreatePostAssociation: problem creating txn: %v", err)) @@ -892,7 +889,6 @@ func (fes *APIServer) DeletePostAssociation(ww http.ResponseWriter, req *http.Re requestData.MinFeeRateNanosPerKB, fes.backendServer.GetMempool(), additionalOutputs, - fes.backendServer.GetFeeEstimator(), ) if err != nil { _AddInternalServerError(ww, fmt.Sprintf("DeletePostAssociation: problem creating txn: %v", err)) diff --git a/routes/exchange.go b/routes/exchange.go index a65cdb88..a75cade4 100644 --- a/routes/exchange.go +++ b/routes/exchange.go @@ -378,7 +378,7 @@ func (fes *APIServer) APIBalance(ww http.ResponseWriter, rr *http.Request) { } // Get all the UTXOs for the public key. - utxoView, err := fes.mempool.GetAugmentedUtxoViewForPublicKey(publicKeyBytes, nil) + utxoView, err := fes.backendServer.GetMempool().GetAugmentedUtxoViewForPublicKey(publicKeyBytes, nil) if err != nil { APIAddError(ww, fmt.Sprintf("APIBalanceRequest: Problem getting UTXOs for public key: %v", err)) return @@ -776,8 +776,7 @@ func (fes *APIServer) APITransferDeSo(ww http.ResponseWriter, rr *http.Request) // Create a MAX transaction txnn, totalInputt, spendAmountt, feeNanoss, err = fes.blockchain.CreateMaxSpend( senderPublicKeyBytes, recipientPub.SerializeCompressed(), nil, - uint64(minFeeRateNanosPerKB), - fes.backendServer.GetMempool(), additionalOutputs, fes.backendServer.GetFeeEstimator()) + uint64(minFeeRateNanosPerKB), fes.backendServer.GetMempool(), additionalOutputs) if err != nil { APIAddError(ww, fmt.Sprintf("APITransferDeSo: Error processing MAX transaction: %v", err)) return @@ -980,7 +979,7 @@ func (fes *APIServer) APITransactionInfo(ww http.ResponseWriter, rr *http.Reques // IsMempool means we should just return all of the transactions that are currently in the mempool. if transactionInfoRequest.IsMempool { // Get all the txns from the mempool. - poolTxns := fes.mempool.GetOrderedTransactions() + poolTxns := fes.backendServer.GetMempool().GetOrderedTransactions() res := &APITransactionInfoResponse{} res.Transactions = []*TransactionResponse{} @@ -1047,7 +1046,7 @@ func (fes *APIServer) APITransactionInfo(ww http.ResponseWriter, rr *http.Reques if txn == nil { // Try to look the transaction up in the mempool before giving up. - txnInPool := fes.mempool.GetMempoolTx(txID) + txnInPool := fes.backendServer.GetMempool().GetMempoolTx(txID) if txnInPool == nil { APIAddError(ww, fmt.Sprintf("APITransactionInfo: Could not find transaction with TransactionIDBase58Check = %s", transactionInfoRequest.TransactionIDBase58Check)) @@ -1162,7 +1161,7 @@ func (fes *APIServer) APITransactionInfo(ww http.ResponseWriter, rr *http.Reques if transactionInfoRequest.LastPublicKeyTransactionIndex <= 0 { // Start with the mempool - poolTxns := fes.mempool.GetOrderedTransactions() + poolTxns := fes.backendServer.GetMempool().GetOrderedTransactions() // Go from most recent to least recent // TODO: Support pagination for mempool transactions @@ -1416,6 +1415,8 @@ func (fes *APIServer) _processTransactionWithKey( // transaction will be mined at the earliest. blockHeight+1, true, + // TODO: Do we want to use fes.backendServer.GetMempool here? + // There are probably other updates we need to make here for PoS as well. fes.mempool) if err != nil { return fmt.Errorf("_processTransactionWithKey: Problem validating txn: %v", err) @@ -1449,7 +1450,7 @@ func (fes *APIServer) _augmentAndProcessTransactionWithSubsidyWithKey( // return an error. totalInput, spendAmount, changeAmount, fees, err := fes.blockchain.AddInputsAndChangeToTransactionWithSubsidy(txn, minFeeRateNanosPerKB, - inputSubsidy, fes.mempool, 0, fes.backendServer.GetFeeEstimator()) + inputSubsidy, fes.backendServer.GetMempool(), 0) if err != nil { return 0, 0, 0, 0, fmt.Errorf("_augmentAndProcessTransactionWithKey: Problem adding inputs and "+ "change to transaction %v: %v", txn, err) diff --git a/routes/message.go b/routes/message.go index 8f150d4b..e30f75a8 100644 --- a/routes/message.go +++ b/routes/message.go @@ -714,8 +714,7 @@ func (fes *APIServer) SendMessageStateless(ww http.ResponseWriter, req *http.Req senderMessagingPublicKey, senderMessagingGroupKeyNameBytes, recipientMessagingPublicKey, recipientMessagingGroupKeyNameBytes, tstamp, extraData, - requestData.MinFeeRateNanosPerKB, fes.backendServer.GetMempool(), additionalOutputs, - fes.backendServer.GetFeeEstimator()) + requestData.MinFeeRateNanosPerKB, fes.backendServer.GetMempool(), additionalOutputs) if err != nil { _AddBadRequestError(ww, fmt.Sprintf("SendMessageStateless: Problem creating transaction: %v", err)) return @@ -974,8 +973,7 @@ func (fes *APIServer) RegisterMessagingGroupKey(ww http.ResponseWriter, req *htt txn, totalInput, changeAmount, fees, err := fes.blockchain.CreateMessagingKeyTxn( ownerPkBytes, messagingPkBytes, messagingKeyNameBytes, messagingKeySignature, []*lib.MessagingGroupMember{}, extraData, - requestData.MinFeeRateNanosPerKB, fes.backendServer.GetMempool(), additionalOutputs, - fes.backendServer.GetFeeEstimator()) + requestData.MinFeeRateNanosPerKB, fes.backendServer.GetMempool(), additionalOutputs) if err != nil { _AddBadRequestError(ww, fmt.Sprintf("RegisterMessagingGroupKey: Problem creating transaction: %v", err)) return diff --git a/routes/new_message.go b/routes/new_message.go index c428c382..67ed7f27 100644 --- a/routes/new_message.go +++ b/routes/new_message.go @@ -377,7 +377,7 @@ func (fes *APIServer) sendMessageHandler( *lib.NewPublicKey(recipientGroupOwnerPkBytes), *lib.NewGroupKeyName(recipientGroupKeyNameBytes), *lib.NewPublicKey(recipientAccessGroupPkbytes), hexDecodedEncryptedMessageBytes, tstamp, newMessageType, newMessageOperationType, extraData, requestData.MinFeeRateNanosPerKB, - fes.backendServer.GetMempool(), additionalOutputs, fes.backendServer.GetFeeEstimator()) + fes.backendServer.GetMempool(), additionalOutputs) if err != nil { return errors.Wrapf(err, "Problem creating transaction: ") } diff --git a/routes/nft.go b/routes/nft.go index d730d16b..c6affae5 100644 --- a/routes/nft.go +++ b/routes/nft.go @@ -262,8 +262,7 @@ func (fes *APIServer) CreateNFT(ww http.ResponseWriter, req *http.Request) { additionalDESORoyaltiesPubKeyMap, additionalCoinRoyaltiesPubKeyMap, extraData, - requestData.MinFeeRateNanosPerKB, fes.backendServer.GetMempool(), additionalOutputs, - fes.backendServer.GetFeeEstimator()) + requestData.MinFeeRateNanosPerKB, fes.backendServer.GetMempool(), additionalOutputs) if err != nil { _AddBadRequestError(ww, fmt.Sprintf("CreateNFT: Problem creating transaction: %v", err)) return @@ -412,8 +411,7 @@ func (fes *APIServer) UpdateNFT(ww http.ResponseWriter, req *http.Request) { uint64(requestData.MinBidAmountNanos), requestData.IsBuyNow, requestData.BuyNowPriceNanos, - requestData.MinFeeRateNanosPerKB, fes.backendServer.GetMempool(), additionalOutputs, - fes.backendServer.GetFeeEstimator()) + requestData.MinFeeRateNanosPerKB, fes.backendServer.GetMempool(), additionalOutputs) if err != nil { _AddBadRequestError(ww, fmt.Sprintf("UpdateNFT: Problem creating transaction: %v", err)) return @@ -570,8 +568,7 @@ func (fes *APIServer) CreateNFTBid(ww http.ResponseWriter, req *http.Request) { nftPostHash, uint64(requestData.SerialNumber), uint64(requestData.BidAmountNanos), - requestData.MinFeeRateNanosPerKB, fes.backendServer.GetMempool(), additionalOutputs, - fes.backendServer.GetFeeEstimator()) + requestData.MinFeeRateNanosPerKB, fes.backendServer.GetMempool(), additionalOutputs) if err != nil { _AddBadRequestError(ww, fmt.Sprintf("CreateNFTBid: Problem creating transaction: %v", err)) return @@ -734,8 +731,7 @@ func (fes *APIServer) AcceptNFTBid(ww http.ResponseWriter, req *http.Request) { bidderPKID.PKID, uint64(requestData.BidAmountNanos), encryptedUnlockableTextBytes, - requestData.MinFeeRateNanosPerKB, fes.backendServer.GetMempool(), additionalOutputs, - fes.backendServer.GetFeeEstimator()) + requestData.MinFeeRateNanosPerKB, fes.backendServer.GetMempool(), additionalOutputs) if err != nil { _AddBadRequestError(ww, fmt.Sprintf("AcceptNFTBid: Problem creating transaction: %v", err)) return @@ -1653,8 +1649,7 @@ func (fes *APIServer) TransferNFT(ww http.ResponseWriter, req *http.Request) { nftPostHash, uint64(requestData.SerialNumber), []byte(requestData.EncryptedUnlockableText), - requestData.MinFeeRateNanosPerKB, fes.backendServer.GetMempool(), additionalOutputs, - fes.backendServer.GetFeeEstimator()) + requestData.MinFeeRateNanosPerKB, fes.backendServer.GetMempool(), additionalOutputs) if err != nil { _AddBadRequestError(ww, fmt.Sprintf("TransferNFT: Problem creating transaction: %v", err)) return @@ -1794,8 +1789,7 @@ func (fes *APIServer) AcceptNFTTransfer(ww http.ResponseWriter, req *http.Reques updaterPublicKeyBytes, nftPostHash, uint64(requestData.SerialNumber), - requestData.MinFeeRateNanosPerKB, fes.backendServer.GetMempool(), additionalOutputs, - fes.backendServer.GetFeeEstimator()) + requestData.MinFeeRateNanosPerKB, fes.backendServer.GetMempool(), additionalOutputs) if err != nil { _AddBadRequestError(ww, fmt.Sprintf("AcceptNFTTransfer: Problem creating transaction: %v", err)) return @@ -1934,8 +1928,7 @@ func (fes *APIServer) BurnNFT(ww http.ResponseWriter, req *http.Request) { updaterPublicKeyBytes, nftPostHash, uint64(requestData.SerialNumber), - requestData.MinFeeRateNanosPerKB, fes.backendServer.GetMempool(), additionalOutputs, - fes.backendServer.GetFeeEstimator()) + requestData.MinFeeRateNanosPerKB, fes.backendServer.GetMempool(), additionalOutputs) if err != nil { _AddBadRequestError(ww, fmt.Sprintf("BurnNFT: Problem creating transaction: %v", err)) return diff --git a/routes/server.go b/routes/server.go index 710a0d4c..9d5f0877 100644 --- a/routes/server.go +++ b/routes/server.go @@ -2490,7 +2490,7 @@ func (fes *APIServer) ValidateJWT(publicKey string, jwtToken string) (bool, erro return nil, errors.Wrapf(err, "Problem parsing derived public key bytes") } // Validate the derived public key. - utxoView, err := fes.mempool.GetAugmentedUniversalView() + utxoView, err := fes.backendServer.GetMempool().GetAugmentedUniversalView() if err != nil { return nil, errors.Wrapf(err, "Problem getting utxoView") } diff --git a/routes/shared.go b/routes/shared.go index 2a82de51..d5a67200 100644 --- a/routes/shared.go +++ b/routes/shared.go @@ -397,8 +397,7 @@ func (fes *APIServer) SendSeedDeSo(recipientPkBytes []byte, amountNanos uint64, if utxoView.GlobalParamsEntry != nil && utxoView.GlobalParamsEntry.MinimumNetworkFeeNanosPerKB > 0 { minFee = utxoView.GlobalParamsEntry.MinimumNetworkFeeNanosPerKB } - _, _, _, _, err = fes.blockchain.AddInputsAndChangeToTransaction(txn, minFee, fes.mempool, - fes.backendServer.GetFeeEstimator()) + _, _, _, _, err = fes.blockchain.AddInputsAndChangeToTransaction(txn, minFee, fes.backendServer.GetMempool()) if err != nil { return nil, fmt.Errorf("SendSeedDeSo: Error adding inputs for seed DeSo: %v", err) } diff --git a/routes/transaction.go b/routes/transaction.go index 11667c73..d1eea6ec 100644 --- a/routes/transaction.go +++ b/routes/transaction.go @@ -57,7 +57,7 @@ func (fes *APIServer) GetTxn(ww http.ResponseWriter, req *http.Request) { copy(txnHash[:], txnHashBytes) } - txnFound := fes.mempool.IsTransactionInPool(txnHash) + txnFound := fes.backendServer.GetMempool().IsTransactionInPool(txnHash) if !txnFound { txnFound = lib.DbCheckTxnExistence(fes.TXIndex.TXIndexChain.DB(), nil, txnHash) } @@ -409,8 +409,7 @@ func (fes *APIServer) UpdateProfile(ww http.ResponseWriter, req *http.Request) { requestData.IsHidden, additionalFees, extraData, - requestData.MinFeeRateNanosPerKB, fes.backendServer.GetMempool(), additionalOutputs, - fes.backendServer.GetFeeEstimator()) + requestData.MinFeeRateNanosPerKB, fes.backendServer.GetMempool(), additionalOutputs) if err != nil { _AddBadRequestError(ww, fmt.Sprintf("UpdateProfile: Problem creating transaction: %v", err)) return @@ -1131,8 +1130,7 @@ func (fes *APIServer) SendDeSo(ww http.ResponseWriter, req *http.Request) { // depending on what the user requested. totalInputt, spendAmountt, changeAmountt, feeNanoss, err = fes.blockchain.AddInputsAndChangeToTransaction( - txnn, requestData.MinFeeRateNanosPerKB, fes.mempool, - fes.backendServer.GetFeeEstimator()) + txnn, requestData.MinFeeRateNanosPerKB, fes.backendServer.GetMempool()) if err != nil { _AddBadRequestError(ww, fmt.Sprintf("SendDeSo: Error processing transaction: %v", err)) return @@ -1241,8 +1239,7 @@ func (fes *APIServer) CreateLikeStateless(ww http.ResponseWriter, req *http.Requ // Try and create the message for the user. txn, totalInput, changeAmount, fees, err := fes.blockchain.CreateLikeTxn( readerPkBytes, postHash, requestData.IsUnlike, - requestData.MinFeeRateNanosPerKB, fes.backendServer.GetMempool(), additionalOutputs, - fes.backendServer.GetFeeEstimator()) + requestData.MinFeeRateNanosPerKB, fes.backendServer.GetMempool(), additionalOutputs) if err != nil { _AddBadRequestError(ww, fmt.Sprintf("CreateLikeStateless: Problem creating transaction: %v", err)) return @@ -1492,8 +1489,7 @@ func (fes *APIServer) SubmitPost(ww http.ResponseWriter, req *http.Request) { tstamp, postExtraData, requestData.IsHidden, - requestData.MinFeeRateNanosPerKB, fes.backendServer.GetMempool(), additionalOutputs, - fes.backendServer.GetFeeEstimator()) + requestData.MinFeeRateNanosPerKB, fes.backendServer.GetMempool(), additionalOutputs) if err != nil { _AddBadRequestError(ww, fmt.Sprintf("SubmitPost: Problem creating transaction: %v", err)) return @@ -1646,8 +1642,7 @@ func (fes *APIServer) CreateFollowTxnStateless(ww http.ResponseWriter, req *http // Try and create the follow for the user. txn, totalInput, changeAmount, fees, err := fes.blockchain.CreateFollowTxn( followerPkBytes, followedPkBytes, requestData.IsUnfollow, - requestData.MinFeeRateNanosPerKB, fes.backendServer.GetMempool(), additionalOutputs, - fes.backendServer.GetFeeEstimator()) + requestData.MinFeeRateNanosPerKB, fes.backendServer.GetMempool(), additionalOutputs) if err != nil { _AddBadRequestError(ww, fmt.Sprintf("CreateFollowTxnStateless: Problem creating transaction: %v", err)) return @@ -1821,8 +1816,7 @@ func (fes *APIServer) BuyOrSellCreatorCoin(ww http.ResponseWriter, req *http.Req requestData.MinDeSoExpectedNanos, requestData.MinCreatorCoinExpectedNanos, // Standard transaction fields - requestData.MinFeeRateNanosPerKB, fes.backendServer.GetMempool(), additionalOutputs, - fes.backendServer.GetFeeEstimator()) + requestData.MinFeeRateNanosPerKB, fes.backendServer.GetMempool(), additionalOutputs) if err != nil { _AddBadRequestError(ww, fmt.Sprintf("BuyOrSellCreatorCoin: Problem adding inputs and change transaction: %v", err)) return @@ -1831,7 +1825,7 @@ func (fes *APIServer) BuyOrSellCreatorCoin(ww http.ResponseWriter, req *http.Req // Add node source to txn metadata fes.AddNodeSourceToTxnMetadata(txn) - utxoView, err := fes.mempool.GetAugmentedUtxoViewForPublicKey(updaterPublicKeyBytes, txn) + utxoView, err := fes.backendServer.GetMempool().GetAugmentedUtxoViewForPublicKey(updaterPublicKeyBytes, txn) if err != nil { _AddBadRequestError(ww, fmt.Sprintf("BuyOrSellCreatorCoin: Problem computing view for transaction: %v", err)) return @@ -2086,8 +2080,7 @@ func (fes *APIServer) TransferCreatorCoin(ww http.ResponseWriter, req *http.Requ requestData.CreatorCoinToTransferNanos, receiverPublicKeyBytes, // Standard transaction fields - requestData.MinFeeRateNanosPerKB, fes.backendServer.GetMempool(), additionalOutputs, - fes.backendServer.GetFeeEstimator()) + requestData.MinFeeRateNanosPerKB, fes.backendServer.GetMempool(), additionalOutputs) if err != nil { _AddBadRequestError(ww, fmt.Sprintf("TransferCreatorCoin: Problem creating transaction: %v", err)) return @@ -2238,8 +2231,7 @@ func (fes *APIServer) SendDiamonds(ww http.ResponseWriter, req *http.Request) { requestData.DiamondLevel, extraData, // Standard transaction fields - requestData.MinFeeRateNanosPerKB, fes.backendServer.GetMempool(), additionalOutputs, - fes.backendServer.GetFeeEstimator()) + requestData.MinFeeRateNanosPerKB, fes.backendServer.GetMempool(), additionalOutputs) if err != nil { _AddBadRequestError(ww, fmt.Sprintf("SendDiamonds: Problem creating transaction: %v", err)) return @@ -2258,8 +2250,7 @@ func (fes *APIServer) SendDiamonds(ww http.ResponseWriter, req *http.Request) { diamondPostHash, requestData.DiamondLevel, // Standard transaction fields - requestData.MinFeeRateNanosPerKB, fes.backendServer.GetMempool(), additionalOutputs, - fes.backendServer.GetFeeEstimator()) + requestData.MinFeeRateNanosPerKB, fes.backendServer.GetMempool(), additionalOutputs) if err != nil { _AddBadRequestError(ww, fmt.Sprintf("SendDiamonds: Problem creating transaction: %v", err)) return @@ -2481,8 +2472,7 @@ func (fes *APIServer) DAOCoin(ww http.ResponseWriter, req *http.Request) { TransferRestrictionStatus: transferRestrictionStatus, }, // Standard transaction fields - requestData.MinFeeRateNanosPerKB, fes.backendServer.GetMempool(), additionalOutputs, - fes.backendServer.GetFeeEstimator()) + requestData.MinFeeRateNanosPerKB, fes.backendServer.GetMempool(), additionalOutputs) if err != nil { _AddBadRequestError(ww, fmt.Sprintf("DAOCoin: Problem adding inputs and change transaction: %v", err)) return @@ -2617,8 +2607,7 @@ func (fes *APIServer) TransferDAOCoin(ww http.ResponseWriter, req *http.Request) DAOCoinToTransferNanos: requestData.DAOCoinToTransferNanos, }, // Standard transaction fields - requestData.MinFeeRateNanosPerKB, fes.backendServer.GetMempool(), additionalOutputs, - fes.backendServer.GetFeeEstimator()) + requestData.MinFeeRateNanosPerKB, fes.backendServer.GetMempool(), additionalOutputs) if err != nil { _AddBadRequestError(ww, fmt.Sprintf("TransferDAOCoin: Problem creating transaction: %v", err)) return @@ -3173,7 +3162,6 @@ func (fes *APIServer) createDAOCoinLimitOrderResponse( minFeeRateNanosPerKB, fes.backendServer.GetMempool(), additionalOutputs, - fes.backendServer.GetFeeEstimator(), ) if err != nil { @@ -3420,8 +3408,7 @@ func (fes *APIServer) AuthorizeDerivedKey(ww http.ResponseWriter, req *http.Requ memo, requestData.TransactionSpendingLimitHex, // Standard transaction fields - requestData.MinFeeRateNanosPerKB, fes.backendServer.GetMempool(), additionalOutputs, - fes.backendServer.GetFeeEstimator()) + requestData.MinFeeRateNanosPerKB, fes.backendServer.GetMempool(), additionalOutputs) if err != nil { _AddBadRequestError(ww, fmt.Sprintf("AuthorizeDerivedKey: Problem creating transaction: %v", err)) return diff --git a/routes/user.go b/routes/user.go index a38ec364..62a2e24d 100644 --- a/routes/user.go +++ b/routes/user.go @@ -2535,7 +2535,7 @@ func (fes *APIServer) _getMempoolNotifications(request *GetNotificationsRequest, // // TODO(performance): This could get slow if the mempool gets big. Fix is to organize everything // in the mempool by public key and only look up transactions that are relevant to this public key. - poolTxns := fes.mempool.GetOrderedTransactions() + poolTxns := fes.backendServer.GetMempool().GetOrderedTransactions() mempoolTxnMetadata := []*TransactionMetadataResponse{} for _, poolTx := range poolTxns { @@ -2631,7 +2631,7 @@ func (fes *APIServer) _getNotificationsCount(request *GetNotificationsRequest) ( // A valid mempool object is used to compute the TransactionMetadata for the mempool // and to allow for things like: filtering notifications for a hidden post. - utxoView, err := fes.mempool.GetAugmentedUniversalView() + utxoView, err := fes.backendServer.GetMempool().GetAugmentedUniversalView() if err != nil { return 0, 0, errors.Errorf("GetNotifications: Problem getting view: %v", err) } @@ -2685,7 +2685,7 @@ func (fes *APIServer) _getNotifications(request *GetNotificationsRequest) ([]*Tr // A valid mempool object is used to compute the TransactionMetadata for the mempool // and to allow for things like: filtering notifications for a hidden post. - utxoView, err := fes.mempool.GetAugmentedUniversalView() + utxoView, err := fes.backendServer.GetMempool().GetAugmentedUniversalView() if err != nil { return nil, nil, errors.Errorf("GetNotifications: Problem getting view: %v", err) } diff --git a/routes/validators.go b/routes/validators.go index 5ac46603..687a668d 100644 --- a/routes/validators.go +++ b/routes/validators.go @@ -125,7 +125,6 @@ func (fes *APIServer) RegisterAsValidator(ww http.ResponseWriter, req *http.Requ requestData.MinFeeRateNanosPerKB, fes.backendServer.GetMempool(), additionalOutputs, - fes.backendServer.GetFeeEstimator(), ) if err != nil { _AddInternalServerError(ww, fmt.Sprintf("RegisterAsValidator: problem creating txn: %v", err)) @@ -200,7 +199,6 @@ func (fes *APIServer) UnregisterAsValidator(ww http.ResponseWriter, req *http.Re requestData.MinFeeRateNanosPerKB, fes.backendServer.GetMempool(), additionalOutputs, - fes.backendServer.GetFeeEstimator(), ) if err != nil { _AddInternalServerError(ww, fmt.Sprintf("UnregisterAsValidator: problem creating txn: %v", err))