Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion proxy/common_neon/costs.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import base58
import psycopg2

from ..environment import EVM_LOADER_ID
from ..environment import EVM_LOADER_ID, WRITE_TRANSACTION_COST_IN_DB
from ..indexer.sql_dict import POSTGRES_USER, POSTGRES_HOST, POSTGRES_DB, POSTGRES_PASSWORD

class SQLCost():
Expand Down Expand Up @@ -47,6 +47,9 @@ def insert(self, hash, cost, used_gas, sender, to_address, sig, status, reason):


def update_transaction_cost(receipt, eth_trx, extra_sol_trx=False, reason=None):
if not WRITE_TRANSACTION_COST_IN_DB:
return

cost = receipt['result']['meta']['preBalances'][0] - receipt['result']['meta']['postBalances'][0]
if eth_trx:
hash = eth_trx.hash_signed().hex()
Expand Down
1 change: 1 addition & 0 deletions proxy/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
EXTRA_GAS = int(os.environ.get("EXTRA_GAS", "0"))
LOG_SENDING_SOLANA_TRANSACTION = os.environ.get("LOG_SENDING_SOLANA_TRANSACTION", "NO") == "YES"
LOG_NEON_CLI_DEBUG = os.environ.get("LOG_NEON_CLI_DEBUG", "NO") == "YES"
WRITE_TRANSACTION_COST_IN_DB = os.environ.get("WRITE_TRANSACTION_COST_IN_DB", "NO") == "YES"

class solana_cli:
def call(self, *args):
Expand Down