Skip to content

Commit

Permalink
Update latest dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
StarNeit committed Dec 1, 2020
1 parent 8579266 commit 1f38b16
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 20 deletions.
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
22 changes: 2 additions & 20 deletions node/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"
"database/sql"
"fmt"
"math"
"math/big"
"sort"
"time"
Expand Down Expand Up @@ -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
}

Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand All @@ -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
}
Expand All @@ -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
Expand Down Expand Up @@ -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())
Expand Down Expand Up @@ -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{
Expand Down Expand Up @@ -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)
}
}
Expand Down

0 comments on commit 1f38b16

Please sign in to comment.