Files
chia-blockchain/chia/wallet/wallet_spend_bundle.py
Richard Kiss c800e06ac4 Remove the dependency of chia.consensus on the module chia.types (#19590)
* Move `chia/types/spend_bundle.py` to wallet.

* Move `compute_additions` functions into wallet.

* Move `chia/types/eligible_coin_spends.py` to `chia/full_node`.
2025-05-09 13:56:01 -05:00

27 lines
1019 B
Python

from __future__ import annotations
from collections.abc import Sequence
from typing import TypeVar
from chia_rs import AugSchemeMPL, CoinSpend, G2Element, SpendBundle
from chia.consensus.default_constants import DEFAULT_CONSTANTS
from chia.wallet.util.debug_spend_bundle import debug_spend_bundle
T_SpendBundle = TypeVar("T_SpendBundle", bound="SpendBundle")
class WalletSpendBundle(SpendBundle):
@classmethod
def aggregate(cls, spend_bundles: Sequence[T_SpendBundle]) -> WalletSpendBundle:
coin_spends: list[CoinSpend] = []
sigs: list[G2Element] = []
for bundle in spend_bundles:
coin_spends += bundle.coin_spends
sigs.append(bundle.aggregated_signature)
aggregated_signature = AugSchemeMPL.aggregate(sigs)
return cls(coin_spends, aggregated_signature)
def debug(self, agg_sig_additional_data: bytes = DEFAULT_CONSTANTS.AGG_SIG_ME_ADDITIONAL_DATA) -> None:
debug_spend_bundle(self, agg_sig_additional_data) # pragma: no cover