mirror of
https://github.com/Chia-Network/chia-blockchain.git
synced 2026-09-28 01:56:38 -04:00
* 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`.
27 lines
1019 B
Python
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
|