Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kill Addrindexrs #2864

Draft
wants to merge 7 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
{
"1CEo6JeFgTTZBHRpnDUGWuTeWeG6X5fsHc-819476": {
"block_index": 819476,
"tx_hash": "58babe9a7ab0a3e5ba0faaab40697bed451f0cd2ea071d17ac86553a665064b4"
},
"1GsjsKKT4nH4GPmDnaxaZEDWgoBpmexwMA-820326": {
"block_index": 820321,
"tx_hash": "b61ac3ab1ba9d63d484e8f83e8b9607bd932c8f4b742095445c3527ab575d972"
},
"bc1qrdprg2uwug0r93eszza3jqk2nsp2475ggf5chu-820637": {
"block_index": 820633,
"tx_hash": "9eade5950a06f8e596283caaa95dba928aa2a5cd9c769e534dfc6a5fad188800"
},
"18xwWKKfkQmrAgaMVqHJ17Q9vzFAaXT4tf-821973": {
"block_index": 821851,
"tx_hash": "33bd1e9dbcdcded5206de365d5d9ab50f0b6b804a7da8c9e8e87cb8a2b1c98f4"
},
"1EaU4MjYNBqu2qaspXvUfqbz4i4sQ6GmhG-821973": {
"block_index": 821973,
"tx_hash": "72c867b209a24e5024b02a6935f3a1edb06c57f45284b4e2b484563458689572"
},
"bc1q8888888p9ffr9dwjs9g35fv6hwfqahfl8nw7l6-822887": {
"block_index": 822887,
"tx_hash": "cbf249d539e97e508a356ce86066262e487b9cdd00c783fcba40a6444c3b0a4c"
},
"bc1qvtrctrp9pggcfq3g4jfkrvn7g7sz0vskz2x0uk-823214": {
"block_index": 823214,
"tx_hash": "daa5c5d5e3e764f027e753f0064352a4a017982968c1fd04a7ea44c0701e640e"
},
"bc1qdc9aws4vdt0wcxlezreme486rht00qw69uhauq-824326": {
"block_index": 824322,
"tx_hash": "2dd3ba20ab7ba030b4e97bca43eebfbb6b0d07a5c535f891cbb101fbf4b7dbf9"
},
"bc1qzmgzxhmevcvu3x6pls2qmc7keucds26f6ssmsk-825182": {
"block_index": 825173,
"tx_hash": "9efc92753fb8c1a172253fa13c8b58ba55b733037d9ab8da2fe55de3d7e3970b"
},
"15W58br8XMQFHktmN2pHrkb44QPg7dEgTC-827798": {
"block_index": 787238,
"tx_hash": "bfc93ea574324f1794de90ee55f19eda423352578b57f17c618c6547a1043ebe"
},
"1L9J6k3vAQmg2ESsgLcYfHyLpZpQ4xgKuu-829953": {
"block_index": 829952,
"tx_hash": "c793679bf10990c18d904281af497254287fa09786ffc304d356a942054293a3"
},
"16k4dCds7kupHkWzRSmqDkHxJftuGCdmsd-832677": {
"block_index": 832675,
"tx_hash": "e1d917308b3a5bcaa592c0828d2192a322c8d2e988407a8c1781c8420fb5d60e"
},
"12xDGbtzh2zRtbfzVcdovUjDLJBCzisqgn-835815": {
"block_index": 835815,
"tx_hash": "4b3ad7bac2bf8f6573954cf9e0a0b0284c3f4303268a0748a5839b1aea3c7517"
},
"1Pp6exhf5bg2mTggVE3RjXo3a549UHb5qW-838178": {
"block_index": 838151,
"tx_hash": "4590db3233595442a1b0fb4bd0e6d08cf038bb5e78019558635f025a4ccbbad3"
},
"bc1qz80sh0wh026derm9pyg7xwv4lmryxktayxxfwq-842374": {
"block_index": 842374,
"tx_hash": "7a6149457a69efadd3ce92466a6bff712f962d8b56fba51fa4584b7a2b83b1de"
},
"bc1q2rn0c89mylzj6c26exda5y2nkezmzh4lh5rkkl-842375": {
"block_index": 842374,
"tx_hash": "3043db292b7f64cbe1cafa32bc733316b162d8a1f41f31a1e6cd224fd5b72415"
},
"bc1q4v00u7yf27g9ghju04th8cwc7jhnsyq5k966ff-844095": {
"block_index": 838068,
"tx_hash": "d74a68f8d30a1e18f8336ed91d2848465bb9496101fe71b8fe71edc9c0a59d1f"
},
"1GyyukjbQANSZsTrn31HDW8bQnhXYJW6d8-855009": {
"block_index": 855009,
"tx_hash": "6d4d1a1dee455935be72dfa0703e0d864eee6862067269040dab2dbb8cb0eddc"
},
"1LJCLfaKU6aNUn5w96cge7woiBE4Hn22x8-858887": {
"block_index": 0,
"tx_hash": "4587498c480700448b71753dbe86dabf9919c5a5cbff929cf1e4de4d2c161b33"
},
"1BxLHZ8fur3RMMyQWLGcNDqn5cyQxscuLd-864951": {
"block_index": 0,
"tx_hash": "c75fce0a6a28588816c302bbb6f8aa2a2e20824612f4013163c1e31edd314e07"
}
}
17 changes: 14 additions & 3 deletions counterparty-core/counterpartycore/lib/messages/dispenser.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
# of units of an asset for a given amount of BTC satoshis received.
# It's a very simple but powerful semantic to allow swaps to operate on-chain.
#

import json
import logging
import os
import struct
from math import floor

from counterpartycore.lib import (
backend,
config,
database,
exceptions,
Expand All @@ -37,6 +37,17 @@
STATUS_CLOSED = 10
STATUS_CLOSING = 11

CURR_DIR = os.path.dirname(os.path.realpath(__file__))
with open(os.path.join(CURR_DIR, "data", "get_oldest_tx.json")) as f:

Check warning

Code scanning / pylint

Using open without explicitly specifying an encoding. Warning

Using open without explicitly specifying an encoding.
GET_OLDEST_TX_DATA = json.load(f)


def get_oldest_tx(address: str, block_index: int):
key = f"{address}-{block_index}"
if key in GET_OLDEST_TX_DATA:
return GET_OLDEST_TX_DATA[key]
return {}


def initialise(db):
cursor = db.cursor()
Expand Down Expand Up @@ -385,7 +396,7 @@
)

if util.enabled("dispenser_origin_permission_extended", block_index):
address_oldest_transaction = backend.addrindexrs.get_oldest_tx(
address_oldest_transaction = get_oldest_tx(
query_address, block_index=util.CURRENT_BLOCK_INDEX
)
if (
Expand Down
Loading