Commit e3b2b73a authored by Heimdall's avatar Heimdall
Browse files

Merge branch '822-issue' into 'develop'

update block cache size for BTC/BCH/ETH/LTC/DOGE

See merge request !1531
parents 7959ca41 a0aa38de
Pipeline #264995573 passed with stages
in 30 minutes and 53 seconds
......@@ -33,7 +33,7 @@ import (
// BlockCacheSize the number of block meta that get store in storage.
const (
BlockCacheSize = 100
BlockCacheSize = 144
MaximumConfirmation = 99999999
MaxAsgardAddresses = 100
// EstimateAverageTxSize for THORChain the estimate tx size is hard code to 250 here , as most of time it will spend 1 input, have 3 output
......@@ -408,19 +408,19 @@ func (c *Client) confirmTx(txHash *chainhash.Hash) bool {
_, err := c.client.GetMempoolEntry(txHash.String())
if err == nil {
return true
} else {
c.logger.Err(err).Msgf("fail to confirm tx(%s) from mempool", txHash.String())
}
// then get raw tx and check if it has confirmations or not
// if no confirmation and not in mempool then invalid
result, err := c.client.GetTransaction(txHash)
_, err = c.client.GetTransaction(txHash)
if err != nil {
if rpcErr, ok := err.(*btcjson.RPCError); ok && rpcErr.Code == btcjson.ErrRPCNoTxInfo {
return false
}
return true
}
if result.Confirmations == 0 {
return false
c.logger.Err(err).Msgf("fail to get tx (%s) from chain , assume it is ok", txHash)
}
return true
}
......
......@@ -34,7 +34,7 @@ import (
// BlockCacheSize the number of block meta that get store in storage.
const (
BlockCacheSize = 100
BlockCacheSize = 144
MaximumConfirmation = 99999999
MaxAsgardAddresses = 100
// EstimateAverageTxSize for THORChain the estimate tx size is hard code to 250 here , as most of time it will spend 1 input, have 3 output
......@@ -408,19 +408,19 @@ func (c *Client) confirmTx(txHash *chainhash.Hash) bool {
_, err := c.client.GetMempoolEntry(txHash.String())
if err == nil {
return true
} else {
c.logger.Err(err).Msgf("fail to confirm tx (%s) from mempool", txHash.String())
}
// then get raw tx and check if it has confirmations or not
// if no confirmation and not in mempool then invalid
result, err := c.client.GetTransaction(txHash)
_, err = c.client.GetTransaction(txHash)
if err != nil {
if rpcErr, ok := err.(*btcjson.RPCError); ok && rpcErr.Code == btcjson.ErrRPCNoTxInfo {
return false
}
return true
}
if result.Confirmations == 0 {
return false
c.logger.Err(err).Msgf("fail to get tx (%s) from chain,assume it is ok", txHash)
}
return true
}
......
......@@ -34,7 +34,7 @@ import (
// BlockCacheSize the number of block meta that get store in storage.
const (
BlockCacheSize = 100
BlockCacheSize = 1440
MaximumConfirmation = 99999999
MaxAsgardAddresses = 100
// EstimateAverageTxSize for THORChain the estimate tx size is hard code to 250 here , as most of time it will spend 1 input, have 3 output
......@@ -410,19 +410,19 @@ func (c *Client) confirmTx(txHash *chainhash.Hash) bool {
_, err := c.client.GetMempoolEntry(txHash.String())
if err == nil {
return true
} else {
c.logger.Err(err).Msgf("fail to confirm tx(%s) from mempool", txHash.String())
}
// then get raw tx and check if it has confirmations or not
// if no confirmation and not in mempool then invalid
result, err := c.client.GetTransaction(txHash)
_, err = c.client.GetTransaction(txHash)
if err != nil {
if rpcErr, ok := err.(*btcjson.RPCError); ok && rpcErr.Code == btcjson.ErrRPCNoTxInfo {
return false
}
return true
}
if result.Confirmations == 0 {
return false
c.logger.Err(err).Msgf("fail to get tx(%s) from chain , assume it is ok", txHash.String())
}
return true
}
......
......@@ -31,7 +31,7 @@ import (
)
const (
BlockCacheSize = 100
BlockCacheSize = 6000
MaxContractGas = 80000
depositEvent = "0xef519b7eb82aaf6ac376a6df2d793843ebfd593de5f1a0601d3cc6ab49ebb395"
transferOutEvent = "0xa9cd03aa3c1b4515114539cd53d22085129d495cb9e9f9af77864526240f1bf7"
......
......@@ -33,7 +33,7 @@ import (
// BlockCacheSize the number of block meta that get store in storage.
const (
BlockCacheSize = 100
BlockCacheSize = 600
MaximumConfirmation = 99999999
MaxAsgardAddresses = 100
// EstimateAverageTxSize for THORChain the estimate tx size is hard code to 250 here , as most of time it will spend 1 input, have 3 output
......@@ -407,18 +407,17 @@ func (c *Client) confirmTx(txHash *chainhash.Hash) bool {
_, err := c.client.GetMempoolEntry(txHash.String())
if err == nil {
return true
} else {
c.logger.Err(err).Msgf("fail to confirm tx(%s) from mempool", txHash.String())
}
// then get raw tx and check if it has confirmations or not
// if no confirmation and not in mempool then invalid
result, err := c.client.GetTransaction(txHash)
_, err = c.client.GetTransaction(txHash)
if err != nil {
if rpcErr, ok := err.(*btcjson.RPCError); ok && rpcErr.Code == btcjson.ErrRPCNoTxInfo {
return false
}
return true
}
if result.Confirmations == 0 {
return false
c.logger.Err(err).Msgf("fail to get tx (%s) from chain", txHash.String())
}
return true
}
......
......@@ -81,6 +81,11 @@ func (t TxIn) GetTotalTransactionValue(asset common.Asset, excludeFrom []common.
if fromAsgard {
continue
}
// skip confirmation counting if it is internal tx
m, err := memo.ParseMemo(item.Memo)
if err == nil && m.IsInternal() {
continue
}
c := item.Coins.GetCoin(asset)
if c.IsEmpty() {
continue
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment