From 1f38b1613d0a3bfe46b4fa5f29114f960b50c0d2 Mon Sep 17 00:00:00 2001 From: StarNeit Date: Tue, 1 Dec 2020 20:28:33 +0100 Subject: [PATCH] Update latest dependency --- go.mod | 2 ++ node/sync.go | 22 ++-------------------- 2 files changed, 4 insertions(+), 20 deletions(-) diff --git a/go.mod b/go.mod index aea0577..1dca2f0 100644 --- a/go.mod +++ b/go.mod @@ -19,3 +19,5 @@ replace github.com/Factom-Asset-Tokens/factom => github.com/Emyrk/factom v0.0.0- replace crawshaw.io/sqlite => github.com/AdamSLevy/sqlite v0.1.3-0.20191014215059-b98bb18889de replace github.com/spf13/pflag v1.0.3 => github.com/AdamSLevy/pflag v1.0.4 + +replace github.com/pegnet/pegnet => /Volumes/Projects/NewProject/Peg_Core/Alex_v2/pegnet \ No newline at end of file diff --git a/node/sync.go b/node/sync.go index 87a6e4c..2d1fe8c 100644 --- a/node/sync.go +++ b/node/sync.go @@ -4,7 +4,6 @@ import ( "context" "database/sql" "fmt" - "math" "math/big" "sort" "time" @@ -498,7 +497,7 @@ func (d *Pegnetd) SnapshotPayouts(tx *sql.Tx, fLog *log.Entry, rates map[fat2.PT if bal.Balances[i] == 0 { // Ignore 0 balances continue } - if (rates[i] == math.MaxUint64 || rates[fat2.PTickerUSD] == math.MaxUint64) && height > V202EnhanceActivation { + if (rates[i] == 0 || rates[fat2.PTickerUSD] == 0) && height > V202EnhanceActivation { continue } @@ -894,9 +893,6 @@ func (d *Pegnetd) applyTransactionBatch(sqlTx *sql.Tx, txBatch *fat2.Transaction // We need to do all checks up front, then apply the tx for _, tx := range txBatch.Transactions { - if (rates[tx.Input.Type] == math.MaxUint64 || rates[tx.Conversion] == math.MaxUint64) && currentHeight > V202EnhanceActivation { - continue - } // First check the input address has the funds bals, err := d.Pegnet.SelectPendingBalances(sqlTx, &tx.Input.Address) if err != nil { @@ -957,9 +953,6 @@ func (d *Pegnetd) applyTransactionBatch(sqlTx *sql.Tx, txBatch *fat2.Transaction } if tx.IsConversion() { - if (rates[tx.Input.Type] == math.MaxUint64 || rates[tx.Conversion] == math.MaxUint64) && currentHeight > V202EnhanceActivation { - continue - } balances[tx.Input.Address][tx.Input.Type] -= tx.Input.Amount outputAmount, err := conversions.Convert(int64(tx.Input.Amount), rates[tx.Input.Type], rates[tx.Conversion]) if err != nil { @@ -1003,9 +996,6 @@ func (d *Pegnetd) recordBatch(sqlTx *sql.Tx, txBatch *fat2.TransactionBatch, rat } for txIndex, tx := range txBatch.Transactions { - if (rates[tx.Input.Type] == math.MaxUint64 || rates[tx.Conversion] == math.MaxUint64) && currentHeight > V202EnhanceActivation { - continue - } _, txErr, err := d.Pegnet.SubFromBalance(sqlTx, &tx.Input.Address, tx.Input.Type, tx.Input.Amount) if err != nil { return err @@ -1017,7 +1007,6 @@ func (d *Pegnetd) recordBatch(sqlTx *sql.Tx, txBatch *fat2.TransactionBatch, rat if err != nil { return err } - if err = d.Pegnet.SetTransactionHistoryExecuted(sqlTx, txBatch, int64(currentHeight)); err != nil { return err } @@ -1032,7 +1021,6 @@ func (d *Pegnetd) recordBatch(sqlTx *sql.Tx, txBatch *fat2.TransactionBatch, rat } continue // PEG Outputs are handled elsewhere } - // Outputs if tx.IsConversion() { // Conversions Output @@ -1088,9 +1076,6 @@ func (d *Pegnetd) recordPegnetRequests(sqlTx *sql.Tx, txBatchs []*fat2.Transacti for j := range txBatchs[i].Transactions { // Retrieve each tx individually. tx := txBatchs[i].Transactions[j] - if rates[tx.Input.Type] == math.MaxUint64 || rates[tx.Conversion] == math.MaxUint64 { - continue - } // The txid helps determine the order when deciding who // gets the dust txid := transactionid.FormatTxID(j, txBatchs[i].Entry.Hash.String()) @@ -1119,9 +1104,6 @@ func (d *Pegnetd) recordPegnetRequests(sqlTx *sql.Tx, txBatchs []*fat2.Transacti totalPaid += int64(pegYield) tx := txData[txid].Batch.Transactions[txData[txid].TxIndex] - if rates[tx.Input.Type] == math.MaxUint64 || rates[tx.Conversion] == math.MaxUint64 { - continue - } refundAmt := conversions.Refund(int64(tx.Input.Amount), int64(pegYield), rates[tx.Input.Type], rates[tx.Conversion]) log.WithFields(log.Fields{ @@ -1326,7 +1308,7 @@ func (d *Pegnetd) GetAssetRates(oprWinners []opr.AssetUint, sprWinners []opr.Ass return nil, fmt.Errorf("opr is out side of tolerance band") } diffWinner := sprWinners[i] - diffWinner.Value = math.MaxUint64 + diffWinner.Value = 0 filteredRates = append(filteredRates, diffWinner) } }