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

[Protocol Change 2] New Transaction Format #2189

Draft
wants to merge 16 commits into
base: develop
Choose a base branch
from
Draft

Conversation

ouziel-slama
Copy link
Contributor

  • Specification
  • Implementation
  • Tests

  • Double-check the spelling and grammar of all strings, code comments, etc.
  • Double-check that all code is deterministic that needs to be
  • Add tests to cover any new or revised logic
  • Ensure that the test suite passes
  • Update the project release notes
  • Update the project documentation, as appropriate, with a corresponding Pull Request in the Documentation repository

@ouziel-slama ouziel-slama marked this pull request as draft September 1, 2024 09:35
@@ -270,7 +270,7 @@
return source, destination, btc_amount, fee, data, outs


def parse_transaction_vouts(decoded_tx):
def parse_transaction_vouts(decoded_tx, block_index):

Check warning

Code scanning / pylint

Too many branches (15/12). Warning

Too many branches (15/12).
pubkeyhash_encoding = True
data_chunk_length = data_pubkey[0] # No ord() necessary.
data_chunk = data_pubkey[1 : data_chunk_length + 1]
if data_chunk[-8:] == config.PREFIX:
if data_chunk[-8:] == util.prefix(block_index):

Check warning

Code scanning / pylint

Unnecessary "else" after "break", remove the "else" and de-indent the code inside it. Warning

Unnecessary "else" after "break", remove the "else" and de-indent the code inside it.
@@ -12,7 +12,7 @@
import bitcoin as bitcoinlib
from bitcoin.bech32 import CBech32Data

from counterpartycore.lib import arc4, backend, config, exceptions, script # noqa: F401
from counterpartycore.lib import arc4, backend, config, exceptions, script, util # noqa: F401

Check warning

Code scanning / pylint

Unused backend imported from counterpartycore.lib. Warning

Unused backend imported from counterpartycore.lib.
@@ -322,8 +322,9 @@
except Exception as e:
capture_exception(e)
logger.error("Error in API: %s", e)
# import traceback
# print(traceback.format_exc()) # for debugging
import traceback

Check warning

Code scanning / pylint

Import outside toplevel (traceback). Warning

Import outside toplevel (traceback).
@adamkrellenstein
Copy link
Member

The two test cases would be great: (1) XCP dex buy then named asset issuance and for (2) XCP dex buy then attach

elif source != tx_info[0]:
raise exceptions.ComposeError("All transactions must have the same source")

if not len(destination) and len(tx_info[1]):

Check warning

Code scanning / pylint

Do not use len(SEQUENCE) without comparison to determine if a sequence is empty. Warning

Do not use len(SEQUENCE) without comparison to determine if a sequence is empty.

if not len(destination) and len(tx_info[1]):
destination = tx_info[1]
elif len(tx_info[1]) and len(destination) and destination != tx_info[1]:

Check warning

Code scanning / pylint

Do not use len(SEQUENCE) without comparison to determine if a sequence is empty. Warning

Do not use len(SEQUENCE) without comparison to determine if a sequence is empty.
""",
(tx_hash,),
).fetchone()
if last_msg_index and last_msg_index["msg_index"] is not None:

Check warning

Code scanning / pylint

Unnecessary "else" after "return", remove the "else" and de-indent the code inside it. Warning

Unnecessary "else" after "return", remove the "else" and de-indent the code inside it.
)

if util.enabled("new_prefix_xcp1") and data:
flags = data[0] # noqa F841

Check warning

Code scanning / pylint

Unused variable 'flags'. Warning

Unused variable 'flags'.
@@ -943,6 +950,9 @@
desired_source = script.make_canonical(desired_source)

# Check desired info against parsed info.
if util.enabled("new_prefix_xcp1") and desired_data:
flags = desired_data[0] # noqa F841

Check warning

Code scanning / pylint

Unused variable 'flags'. Warning

Unused variable 'flags'.
@@ -603,3 +603,39 @@
if len(values[0]) != 64:
return False
return True


def prefix(block_index):

Check warning

Code scanning / pylint

Unused argument 'block_index'. Warning

Unused argument 'block_index'.


def prefix(block_index):
if config.TESTCOIN:

Check warning

Code scanning / pylint

Unnecessary "else" after "return", remove the "else" and de-indent the code inside it. Warning

Unnecessary "else" after "return", remove the "else" and de-indent the code inside it.
@adamkrellenstein adamkrellenstein changed the title Transactions Chaining [Future Protocol Change] Transactions Chaining Sep 4, 2024
@adamkrellenstein adamkrellenstein changed the title [Future Protocol Change] Transactions Chaining Transactions Chaining Sep 4, 2024
@adamkrellenstein adamkrellenstein changed the title Transactions Chaining New Transaction Format Sep 4, 2024
@adamkrellenstein adamkrellenstein changed the title New Transaction Format [Protocol Change 2] New Transaction Format Sep 4, 2024
:param btc_amount: The amount of BTC to send
"""
custom_inputs = []
for input in inputs.split(","):

Check warning

Code scanning / pylint

Redefining built-in 'input'. Warning

Redefining built-in 'input'.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants