Skip to content

Commit

Permalink
Merge branch 'develop' into bumpversion
Browse files Browse the repository at this point in the history
  • Loading branch information
Ouziel committed Oct 2, 2024
2 parents b5b3c29 + 650f24e commit b7425f3
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 7 deletions.
6 changes: 3 additions & 3 deletions counterparty-core/counterpartycore/lib/transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ def determine_encoding(
else:
encoding = desired_encoding

if encoding == "p2sh" and not util.enabled("p2sh_encoding"):
raise exceptions.TransactionError("P2SH encoding not enabled yet")
if encoding == "p2sh":
raise exceptions.TransactionError("`P2SH` encoding deprecated, please use `multisig`")

elif encoding not in ("pubkeyhash", "multisig", "opreturn", "p2sh"):
if encoding not in ("pubkeyhash", "multisig", "opreturn"):
raise exceptions.TransactionError("Unknown encoding‐scheme.")

return encoding
Expand Down
19 changes: 18 additions & 1 deletion counterparty-core/counterpartycore/test/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from pycoin.coins.bitcoin import Tx # noqa: F401

from counterpartycore import server
from counterpartycore.lib import arc4, config, database, ledger, log, script, util
from counterpartycore.lib import arc4, config, database, exceptions, ledger, log, script, util
from counterpartycore.lib.api import api_server as api_v2
from counterpartycore.lib.api import api_v1 as api
from counterpartycore.test import util_test
Expand Down Expand Up @@ -595,6 +595,22 @@ def get_utxo_address_and_value(value):
def get_transaction_fee(db, transaction_type, block_index):
return 10

def determine_encoding(
data, desired_encoding="auto", op_return_max_size=config.OP_RETURN_MAX_SIZE
):
if desired_encoding == "auto":
if len(data) + len(config.PREFIX) <= op_return_max_size:
encoding = "opreturn"
else:
encoding = "multisig"
else:
encoding = desired_encoding

if encoding not in ("pubkeyhash", "multisig", "opreturn", "p2sh"):
raise exceptions.TransactionError("Unknown encoding‐scheme.")

return encoding

monkeypatch.setattr("counterpartycore.lib.transaction.arc4.init_arc4", init_arc4)
monkeypatch.setattr(
"counterpartycore.lib.backend.addrindexrs.get_unspent_txouts", get_unspent_txouts
Expand Down Expand Up @@ -637,3 +653,4 @@ def get_transaction_fee(db, transaction_type, block_index):
)

monkeypatch.setattr("counterpartycore.lib.gas.get_transaction_fee", get_transaction_fee)
monkeypatch.setattr("counterpartycore.lib.transaction.determine_encoding", determine_encoding)
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
],
None,
),
{"encoding": "singlesig", "regular_dust_size": DP["regular_dust_size"]},
{"encoding": "opreturn", "regular_dust_size": DP["regular_dust_size"]},
),
"error": (exceptions.TransactionError, "Destination output is dust."),
},
Expand Down
8 changes: 6 additions & 2 deletions release-notes/release-notes-v10.4.2.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@

# Upgrading

This release is not a protocol change and does not require any reparsing.

# ChangeLog


## Protocol Changes


Expand All @@ -20,11 +22,13 @@

## Codebase

## API

* No longer expire mempool entries after 24 hours
* Fetch old mempool entries from Bitcoin Core after node startup

## API

* Expose timestamp field for "first seen in mempool" (for client-side filtering)
* Disable `p2sh` encoding

## CLI

Expand Down

0 comments on commit b7425f3

Please sign in to comment.