mirror of
https://github.com/Chia-Network/chia-blockchain.git
synced 2024-08-17 14:50:57 +03:00
Revert "Merge"
This reverts commit23a1e688c5
, reversing changes made toa850246c6f
.
This commit is contained in:
parent
23a1e688c5
commit
680331859f
@ -44,16 +44,6 @@ jobs:
|
||||
echo "::set-output name=CHIA_INSTALLER_VERSION::$(python3 ./build_scripts/installer-version.py)"
|
||||
deactivate
|
||||
|
||||
- name: Test for secrets access
|
||||
id: check_secrets
|
||||
shell: bash
|
||||
run: |
|
||||
unset HAS_SECRET
|
||||
if [ -n "$SECRET" ]; then HAS_SECRET='true' ; fi
|
||||
echo ::set-output name=HAS_SECRET::${HAS_SECRET}
|
||||
env:
|
||||
SECRET: "${{ secrets.test_pypi_password }}"
|
||||
|
||||
- name: Build ARM64 Installer
|
||||
run: |
|
||||
podman run --rm=true \
|
||||
@ -92,12 +82,10 @@ jobs:
|
||||
path: ${{ github.workspace }}/build_scripts/final_installer/
|
||||
|
||||
- name: Install AWS CLI
|
||||
if: steps.check_secrets.outputs.HAS_SECRET
|
||||
run: |
|
||||
sudo apt-get install -y awscli
|
||||
|
||||
- name: Configure AWS Credentials
|
||||
if: steps.check_secrets.outputs.HAS_SECRET
|
||||
uses: aws-actions/configure-aws-credentials@v1
|
||||
with:
|
||||
aws-access-key-id: ${{ secrets.INSTALLER_UPLOAD_KEY }}
|
||||
@ -105,7 +93,6 @@ jobs:
|
||||
aws-region: us-west-2
|
||||
|
||||
- name: Upload to s3
|
||||
if: steps.check_secrets.outputs.HAS_SECRET
|
||||
run: |
|
||||
aws s3 cp ${{ github.workspace }}/build_scripts/final_installer/*.deb s3://download-chia-net/builds/
|
||||
|
||||
@ -118,25 +105,13 @@ jobs:
|
||||
sha256sum ${{ github.workspace }}/build_scripts/final_installer/chia-blockchain_${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}_arm64.deb > ${{ github.workspace }}/build_scripts/final_installer/chia-blockchain_${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}_arm64.deb.sha256
|
||||
ls ${{ github.workspace }}/build_scripts/final_installer/
|
||||
|
||||
- name: Install py3createtorrent
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
run: |
|
||||
pip3 install py3createtorrent
|
||||
|
||||
- name: Create torrent
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
run: |
|
||||
py3createtorrent -f -t udp://tracker.opentrackr.org:1337/announce ${{ github.workspace }}/build_scripts/final_installer/chia-blockchain_${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}_arm64.deb -o ${{ github.workspace }}/build_scripts/final_installer/chia-blockchain_${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}_arm64.deb.torrent --webseed https://download-chia-net.s3.us-west-2.amazonaws.com/install/chia-blockchain_${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}_arm64.deb
|
||||
ls ${{ github.workspace }}/build_scripts/final_installer/
|
||||
|
||||
- name: Upload Release Files
|
||||
if: steps.check_secrets.outputs.HAS_SECRET && startsWith(github.ref, 'refs/tags/')
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
run: |
|
||||
ls ${{ github.workspace }}/build_scripts/final_installer/
|
||||
aws s3 cp ${{ github.workspace }}/build_scripts/final_installer/*.deb s3://download-chia-net/install/
|
||||
aws s3 cp ${{ github.workspace }}/build_scripts/final_installer/*.sha256 s3://download-chia-net/install/
|
||||
aws s3 cp ${{ github.workspace }}/build_scripts/final_installer/chia-blockchain_${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}_arm64.deb.torrent s3://download-chia-net/torrents/
|
||||
|
||||
- name: Clean up on self hosted runner
|
||||
run: |
|
||||
sudo rm -rf build_scripts/final_installer
|
||||
sudo rm -rf build_scrpits/final_installer
|
||||
|
33
.github/workflows/build-linux-installer.yml
vendored
33
.github/workflows/build-linux-installer.yml
vendored
@ -78,16 +78,6 @@ jobs:
|
||||
echo "::set-output name=CHIA_INSTALLER_VERSION::$(python3 ./build_scripts/installer-version.py)"
|
||||
deactivate
|
||||
|
||||
- name: Test for secrets access
|
||||
id: check_secrets
|
||||
shell: bash
|
||||
run: |
|
||||
unset HAS_SECRET
|
||||
if [ -n "$SECRET" ]; then HAS_SECRET='true' ; fi
|
||||
echo ::set-output name=HAS_SECRET::${HAS_SECRET}
|
||||
env:
|
||||
SECRET: "${{ secrets.test_pypi_password }}"
|
||||
|
||||
- name: Run install script
|
||||
env:
|
||||
INSTALL_PYTHON_VERSION: ${{ matrix.python-version }}
|
||||
@ -117,7 +107,6 @@ jobs:
|
||||
path: ${{ github.workspace }}/build_scripts/final_installer/
|
||||
|
||||
- name: Configure AWS Credentials
|
||||
if: steps.check_secrets.outputs.HAS_SECRET
|
||||
uses: aws-actions/configure-aws-credentials@v1
|
||||
with:
|
||||
aws-access-key-id: ${{ secrets.INSTALLER_UPLOAD_KEY }}
|
||||
@ -125,7 +114,6 @@ jobs:
|
||||
aws-region: us-west-2
|
||||
|
||||
- name: Upload to s3
|
||||
if: steps.check_secrets.outputs.HAS_SECRET
|
||||
env:
|
||||
CHIA_INSTALLER_VERSION: ${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}
|
||||
run: |
|
||||
@ -144,29 +132,10 @@ jobs:
|
||||
sha256sum ${{ github.workspace }}/build_scripts/final_installer/chia-blockchain_${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}_amd64.deb > ${{ github.workspace }}/build_scripts/final_installer/chia-blockchain_${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}_amd64.deb.sha256
|
||||
ls ${{ github.workspace }}/build_scripts/final_installer/
|
||||
|
||||
- name: Install py3createtorrent
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
run: |
|
||||
pip3 install py3createtorrent
|
||||
|
||||
- name: Create .rpm torrent
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
run: |
|
||||
py3createtorrent -f -t udp://tracker.opentrackr.org:1337/announce ${{ github.workspace }}/build_scripts/final_installer/chia-blockchain-${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}-1.x86_64.rpm -o ${{ github.workspace }}/build_scripts/final_installer/chia-blockchain-${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}-1.x86_64.rpm.torrent --webseed https://download-chia-net.s3.us-west-2.amazonaws.com/install/chia-blockchain-${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}-1.x86_64.rpm
|
||||
ls
|
||||
|
||||
- name: Create .deb torrent
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
run: |
|
||||
py3createtorrent -f -t udp://tracker.opentrackr.org:1337/announce ${{ github.workspace }}/build_scripts/final_installer/chia-blockchain_${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}_amd64.deb -o ${{ github.workspace }}/build_scripts/final_installer/chia-blockchain_${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}_amd64.deb.torrent --webseed https://download-chia-net.s3.us-west-2.amazonaws.com/install/chia-blockchain_${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}_amd64.deb
|
||||
ls
|
||||
|
||||
- name: Upload Release Files
|
||||
if: steps.check_secrets.outputs.HAS_SECRET && startsWith(github.ref, 'refs/tags/')
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
run: |
|
||||
aws s3 cp ${{ github.workspace }}/build_scripts/final_installer/chia-blockchain_${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}_amd64.deb s3://download-chia-net/install/
|
||||
aws s3 cp ${{ github.workspace }}/build_scripts/final_installer/chia-blockchain_${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}_amd64.deb.sha256 s3://download-chia-net/install/
|
||||
aws s3 cp ${{ github.workspace }}/build_scripts/final_installer/chia-blockchain_${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}_amd64.deb.torrent s3://download-chia-net/torrents/
|
||||
aws s3 cp ${{ github.workspace }}/build_scripts/final_installer/chia-blockchain-${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}-1.x86_64.rpm s3://download-chia-net/install/
|
||||
aws s3 cp ${{ github.workspace }}/build_scripts/final_installer/chia-blockchain-${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}-1.x86_64.rpm.sha256 s3://download-chia-net/install/
|
||||
aws s3 cp ${{ github.workspace }}/build_scripts/final_installer/chia-blockchain-${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}-1.x86_64.rpm.torrent s3://download-chia-net/torrents/
|
||||
|
11
.github/workflows/build-macos-installer.yml
vendored
11
.github/workflows/build-macos-installer.yml
vendored
@ -146,20 +146,9 @@ jobs:
|
||||
run: |
|
||||
aws s3 cp ${{ github.workspace }}/build_scripts/final_installer/Chia-Catalina-${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}.dmg s3://download-chia-net/builds/
|
||||
|
||||
- name: Install py3createtorrent
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
run: |
|
||||
pip3 install py3createtorrent
|
||||
|
||||
- name: Create torrent
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
run: |
|
||||
py3createtorrent -t torrent.chia.net ${{ github.workspace }}/build_scripts/final_installer/Chia-Catalina-${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}.dmg ${{ github.workspace }}/build_scripts/final_installer/Chia-Catalina-${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}.dmg.torrent
|
||||
|
||||
#Temporarily disable release uploads
|
||||
# - name: Upload Release Files
|
||||
# if: startsWith(github.ref, 'refs/tags/')
|
||||
# run: |
|
||||
# aws s3 cp ${{ github.workspace }}/build_scripts/final_installer/Chia-Catalina-${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}.dmg s3://download-chia-net/install/
|
||||
# aws s3 cp ${{ github.workspace }}/build_scripts/final_installer/Chia-Catalina-${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}.dmg.sha256 s3://download-chia-net/install/
|
||||
# aws s3 cp ${{ github.workspace }}/build_scripts/final_installer/Chia-Catalina-${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}.dmg.torrent s3://download-chia-net/install/
|
17
.github/workflows/build-windows-installer.yml
vendored
17
.github/workflows/build-windows-installer.yml
vendored
@ -113,12 +113,10 @@ jobs:
|
||||
|
||||
|
||||
- name: Install AWS CLI
|
||||
if: steps.check_secrets.outputs.HAS_SECRET
|
||||
run: |
|
||||
msiexec.exe /i https://awscli.amazonaws.com/AWSCLIV2.msi
|
||||
|
||||
- name: Configure AWS Credentials
|
||||
if: steps.check_secrets.outputs.HAS_SECRET
|
||||
uses: aws-actions/configure-aws-credentials@v1
|
||||
with:
|
||||
aws-access-key-id: ${{ secrets.INSTALLER_UPLOAD_KEY }}
|
||||
@ -126,7 +124,6 @@ jobs:
|
||||
aws-region: us-west-2
|
||||
|
||||
- name: Upload to s3
|
||||
if: steps.check_secrets.outputs.HAS_SECRET
|
||||
env:
|
||||
CHIA_INSTALLER_VERSION: ${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}
|
||||
run: |
|
||||
@ -141,23 +138,11 @@ jobs:
|
||||
certutil.exe -hashfile ${{ github.workspace }}\chia-blockchain-gui\release-builds\windows-installer\ChiaSetup-${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}.exe SHA256 > ${{ github.workspace }}\chia-blockchain-gui\release-builds\windows-installer\ChiaSetup-${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}.exe.checksum
|
||||
ls ${{ github.workspace }}\chia-blockchain-gui\release-builds\windows-installer\
|
||||
|
||||
- name: Install py3createtorrent
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
run: |
|
||||
pip3 install py3createtorrent
|
||||
|
||||
- name: Create torrent
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
run: |
|
||||
py3createtorrent -f -t udp://tracker.opentrackr.org:1337/announce ${{ github.workspace }}\chia-blockchain-gui\release-builds\windows-installer\ChiaSetup-${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}.exe -o ${{ github.workspace }}\chia-blockchain-gui\release-builds\windows-installer\ChiaSetup-${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}.exe.torrent --webseed https://download-chia-net.s3.us-west-2.amazonaws.com/install/ChiaSetup-${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}.exe
|
||||
ls
|
||||
|
||||
- name: Upload Release Files
|
||||
if: steps.check_secrets.outputs.HAS_SECRET && startsWith(github.ref, 'refs/tags/')
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
env:
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.INSTALLER_UPLOAD_KEY }}
|
||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.INSTALLER_UPLOAD_SECRET }}
|
||||
run: |
|
||||
aws s3 cp ${{ github.workspace }}\chia-blockchain-gui\release-builds\windows-installer\ChiaSetup-${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}.exe s3://download-chia-net/install/
|
||||
aws s3 cp ${{ github.workspace }}\chia-blockchain-gui\release-builds\windows-installer\ChiaSetup-${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}.exe.checksum s3://download-chia-net/install/
|
||||
aws s3 cp ${{ github.workspace }}\chia-blockchain-gui\release-builds\windows-installer\ChiaSetup-${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}.exe.torrent s3://download-chia-net/torrents/
|
||||
|
@ -111,19 +111,11 @@ steps:
|
||||
aws s3 cp $(System.DefaultWorkingDirectory)/build_scripts/final_installer/*.dmg s3://download-chia-net/builds/
|
||||
displayName: "Upload to S3"
|
||||
|
||||
- bash: |
|
||||
pip3 install py3createtorrent
|
||||
py3createtorrent -f -t udp://tracker.opentrackr.org:1337/announce $(System.DefaultWorkingDirectory)/build_scripts/final_installer/$CHIA_VERSION.dmg -o $(System.DefaultWorkingDirectory)/build_scripts/final_installer/$CHIA_VERSION.dmg.torrent --webseed https://download-chia-net.s3.us-west-2.amazonaws.com/install/$CHIA_VERSION.dmg
|
||||
ls
|
||||
displayName: "Create torrent file"
|
||||
condition: contains(variables['build.sourceBranch'], 'refs/tags/')
|
||||
|
||||
- bash: |
|
||||
export AWS_ACCESS_KEY_ID=$(AccessKey)
|
||||
export AWS_SECRET_ACCESS_KEY=$(SecretKey)
|
||||
export AWS_DEFAULT_REGION=us-west-2
|
||||
aws s3 cp $(System.DefaultWorkingDirectory)/build_scripts/final_installer/$CHIA_VERSION.dmg s3://download-chia-net/install/
|
||||
aws s3 cp $(System.DefaultWorkingDirectory)/build_scripts/final_installer/$CHIA_VERSION.dmg.sha256 s3://download-chia-net/install/
|
||||
aws s3 cp $(System.DefaultWorkingDirectory)/build_scripts/final_installer/$CHIA_VERSION.dmg.torrent s3://download-chia-net/torrents/
|
||||
displayName: "Upload Release Files"
|
||||
condition: contains(variables['build.sourceBranch'], 'refs/tags/')
|
||||
condition: contains(variables['build.sourceBranch'], 'refs/tags/')
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 444c6966fe50183c8d72cbc972c5403db341739c
|
||||
Subproject commit 725071236eff8c81d5b267dc8eb69d7e03f3df8c
|
@ -1761,10 +1761,9 @@ class FullNode:
|
||||
vdf_proof: VDFProof,
|
||||
height: uint32,
|
||||
field_vdf: CompressibleVDFField,
|
||||
) -> bool:
|
||||
):
|
||||
full_blocks = await self.block_store.get_full_blocks_at([height])
|
||||
assert len(full_blocks) > 0
|
||||
replaced = False
|
||||
for block in full_blocks:
|
||||
new_block = None
|
||||
block_record = await self.blockchain.get_block_record_from_db(self.blockchain.height_to_hash(height))
|
||||
@ -1799,12 +1798,11 @@ class FullNode:
|
||||
if block.reward_chain_block.challenge_chain_ip_vdf == vdf_info:
|
||||
new_block = dataclasses.replace(block, challenge_chain_ip_proof=vdf_proof)
|
||||
if new_block is None:
|
||||
continue
|
||||
self.log.debug("did not replace any proof, vdf does not match")
|
||||
return
|
||||
async with self.db_wrapper.lock:
|
||||
await self.block_store.add_full_block(new_block.header_hash, new_block, block_record)
|
||||
await self.block_store.db_wrapper.commit_transaction()
|
||||
replaced = True
|
||||
return replaced
|
||||
|
||||
async def respond_compact_proof_of_time(self, request: timelord_protocol.RespondCompactProofOfTime):
|
||||
field_vdf = CompressibleVDFField(int(request.field_vdf))
|
||||
@ -1813,10 +1811,7 @@ class FullNode:
|
||||
):
|
||||
return None
|
||||
async with self.blockchain.compact_proof_lock:
|
||||
replaced = await self._replace_proof(request.vdf_info, request.vdf_proof, request.height, field_vdf)
|
||||
if not replaced:
|
||||
self.log.error(f"Could not replace compact proof: {request.height}")
|
||||
return None
|
||||
await self._replace_proof(request.vdf_info, request.vdf_proof, request.height, field_vdf)
|
||||
msg = make_msg(
|
||||
ProtocolMessageTypes.new_compact_vdf,
|
||||
full_node_protocol.NewCompactVDF(request.height, request.header_hash, request.field_vdf, request.vdf_info),
|
||||
@ -1895,10 +1890,7 @@ class FullNode:
|
||||
async with self.blockchain.compact_proof_lock:
|
||||
if self.blockchain.seen_compact_proofs(request.vdf_info, request.height):
|
||||
return None
|
||||
replaced = await self._replace_proof(request.vdf_info, request.vdf_proof, request.height, field_vdf)
|
||||
if not replaced:
|
||||
self.log.error(f"Could not replace compact proof: {request.height}")
|
||||
return None
|
||||
await self._replace_proof(request.vdf_info, request.vdf_proof, request.height, field_vdf)
|
||||
msg = make_msg(
|
||||
ProtocolMessageTypes.new_compact_vdf,
|
||||
full_node_protocol.NewCompactVDF(request.height, request.header_hash, request.field_vdf, request.vdf_info),
|
||||
|
@ -25,7 +25,6 @@ from chia.util.ws_message import WsRpcMessage, create_payload_dict
|
||||
from chia.wallet.cc_wallet.cc_wallet import CCWallet
|
||||
from chia.wallet.derive_keys import master_sk_to_singleton_owner_sk
|
||||
from chia.wallet.rl_wallet.rl_wallet import RLWallet
|
||||
from chia.wallet.derive_keys import master_sk_to_farmer_sk, master_sk_to_pool_sk
|
||||
from chia.wallet.did_wallet.did_wallet import DIDWallet
|
||||
from chia.wallet.trade_record import TradeRecord
|
||||
from chia.wallet.transaction_record import TransactionRecord
|
||||
@ -212,8 +211,6 @@ class WalletRpcApi:
|
||||
"fingerprint": fingerprint,
|
||||
"sk": bytes(sk).hex(),
|
||||
"pk": bytes(sk.get_g1()).hex(),
|
||||
"farmer_pk": bytes(master_sk_to_farmer_sk(sk).get_g1()).hex(),
|
||||
"pool_pk": bytes(master_sk_to_pool_sk(sk).get_g1()).hex(),
|
||||
"seed": s,
|
||||
},
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ from chia.rpc.wallet_rpc_api import WalletRpcApi
|
||||
from chia.server.outbound_message import NodeType
|
||||
from chia.server.start_service import run_service
|
||||
from chia.types.peer_info import PeerInfo
|
||||
from chia.util.block_tools import test_constants
|
||||
from chia.util.config import load_config_cli, load_config
|
||||
from chia.util.default_root import DEFAULT_ROOT_PATH
|
||||
from chia.util.keychain import Keychain
|
||||
@ -80,8 +81,6 @@ def main() -> None:
|
||||
# This is simulator
|
||||
local_test = config["testing"]
|
||||
if local_test is True:
|
||||
from tests.block_tools import test_constants
|
||||
|
||||
constants = test_constants
|
||||
current = config["database_path"]
|
||||
config["database_path"] = f"{current}_simulation"
|
||||
|
@ -1,5 +1,5 @@
|
||||
if __name__ == "__main__":
|
||||
from tests.block_tools import BlockTools, test_constants
|
||||
from chia.util.block_tools import BlockTools, test_constants
|
||||
from chia.util.default_root import DEFAULT_ROOT_PATH
|
||||
|
||||
# TODO: mariano: fix this with new consensus
|
||||
|
@ -6,7 +6,7 @@ from chia.full_node.full_node import FullNode
|
||||
from chia.rpc.full_node_rpc_api import FullNodeRpcApi
|
||||
from chia.server.outbound_message import NodeType
|
||||
from chia.server.start_service import run_service
|
||||
from tests.block_tools import BlockTools, test_constants
|
||||
from chia.util.block_tools import BlockTools, test_constants
|
||||
from chia.util.config import load_config_cli
|
||||
from chia.util.default_root import DEFAULT_ROOT_PATH
|
||||
from chia.util.path import mkdir, path_from_root
|
||||
|
@ -65,7 +65,7 @@ from chia.util.ints import uint8, uint32, uint64, uint128
|
||||
from chia.util.keychain import Keychain, bytes_to_mnemonic
|
||||
from chia.util.path import mkdir
|
||||
from chia.util.vdf_prover import get_vdf_info_and_proof
|
||||
from tests.wallet_tools import WalletTool
|
||||
from chia.util.wallet_tools import WalletTool
|
||||
from chia.wallet.derive_keys import (
|
||||
master_sk_to_farmer_sk,
|
||||
master_sk_to_local_sk,
|
@ -115,7 +115,7 @@ logging: &logging
|
||||
log_maxfilesrotation: 7 # Max files in rotation. Default value 7 if the key is not set
|
||||
log_syslog: False # If True, outputs to SysLog host and port specified
|
||||
log_syslog_host: "localhost" # Send logging messages to a remote or local Unix syslog
|
||||
log_syslog_port: 514 # UDP port of the remote or local Unix syslog
|
||||
log_syslog_port: 514 # UDP port of the remote or local Unix syslog
|
||||
|
||||
harvester:
|
||||
# The harvester server (if run) will run on this port
|
||||
|
@ -28,13 +28,13 @@ from chia.types.end_of_slot_bundle import EndOfSubSlotBundle
|
||||
from chia.types.full_block import FullBlock
|
||||
from chia.types.spend_bundle import SpendBundle
|
||||
from chia.types.unfinished_block import UnfinishedBlock
|
||||
from tests.block_tools import BlockTools, get_vdf_info_and_proof
|
||||
from chia.util.block_tools import BlockTools, get_vdf_info_and_proof
|
||||
from chia.util.errors import Err
|
||||
from chia.util.hash import std_hash
|
||||
from chia.util.ints import uint8, uint64, uint32
|
||||
from chia.util.merkle_set import MerkleSet
|
||||
from chia.util.recursive_replace import recursive_replace
|
||||
from tests.wallet_tools import WalletTool
|
||||
from chia.util.wallet_tools import WalletTool
|
||||
from tests.core.fixtures import default_400_blocks # noqa: F401; noqa: F401
|
||||
from tests.core.fixtures import default_1000_blocks # noqa: F401
|
||||
from tests.core.fixtures import default_10000_blocks # noqa: F401
|
||||
|
@ -12,7 +12,7 @@ from chia.types.condition_with_args import ConditionWithArgs
|
||||
from chia.types.spend_bundle import SpendBundle
|
||||
from chia.util.errors import ConsensusError, Err
|
||||
from chia.util.ints import uint64
|
||||
from tests.wallet_tools import WalletTool
|
||||
from chia.util.wallet_tools import WalletTool
|
||||
from tests.core.full_node.test_full_node import connect_and_get_peer
|
||||
from tests.setup_nodes import bt, setup_two_nodes, test_constants
|
||||
from tests.util.generator_tools_testing import run_and_get_removals_and_additions
|
||||
|
@ -6,7 +6,7 @@ import pytest
|
||||
from chia.server.outbound_message import NodeType
|
||||
from chia.server.server import ssl_context_for_server
|
||||
from chia.types.peer_info import PeerInfo
|
||||
from tests.block_tools import BlockTools
|
||||
from chia.util.block_tools import BlockTools
|
||||
from chia.util.ints import uint16
|
||||
from chia.util.ws_message import create_payload
|
||||
from tests.core.node_height import node_height_at_least
|
||||
|
@ -370,5 +370,5 @@ class TestFullSync:
|
||||
s.new_sub_slot_iters * 2,
|
||||
)
|
||||
await full_node_2.full_node.sync_from_fork_point(0, 500, peak1.header_hash, summaries2)
|
||||
log.info(f"full node height {full_node_2.full_node.blockchain.get_peak().height}")
|
||||
assert node_height_exactly(full_node_2, 320)
|
||||
log.warning(f"full node height {full_node_2.full_node.blockchain.get_peak().height}")
|
||||
assert node_height_between(full_node_2, 320, 400)
|
||||
|
@ -18,7 +18,7 @@ from chia.types.full_block import FullBlock
|
||||
from chia.types.generator_types import BlockGenerator
|
||||
from chia.util.generator_tools import tx_removals_and_additions
|
||||
from chia.util.ints import uint64, uint32
|
||||
from tests.wallet_tools import WalletTool
|
||||
from chia.util.wallet_tools import WalletTool
|
||||
from chia.util.db_wrapper import DBWrapper
|
||||
from tests.setup_nodes import bt, test_constants
|
||||
|
||||
|
@ -23,7 +23,7 @@ from chia.types.coin_solution import CoinSolution
|
||||
from chia.types.condition_opcodes import ConditionOpcode
|
||||
from chia.types.full_block import FullBlock
|
||||
from chia.types.spend_bundle import SpendBundle
|
||||
from tests.block_tools import BlockTools, test_constants
|
||||
from chia.util.block_tools import BlockTools, test_constants
|
||||
from chia.util.errors import Err
|
||||
from chia.util.ints import uint32
|
||||
|
||||
|
@ -30,14 +30,14 @@ from chia.types.mempool_inclusion_status import MempoolInclusionStatus
|
||||
from chia.types.peer_info import PeerInfo, TimestampedPeerInfo
|
||||
from chia.types.spend_bundle import SpendBundle
|
||||
from chia.types.unfinished_block import UnfinishedBlock
|
||||
from tests.block_tools import get_signage_point
|
||||
from chia.util.block_tools import get_signage_point
|
||||
from chia.util.clvm import int_to_bytes
|
||||
from chia.util.errors import Err
|
||||
from chia.util.hash import std_hash
|
||||
from chia.util.ints import uint8, uint16, uint32, uint64
|
||||
from chia.util.recursive_replace import recursive_replace
|
||||
from chia.util.vdf_prover import get_vdf_info_and_proof
|
||||
from tests.wallet_tools import WalletTool
|
||||
from chia.util.wallet_tools import WalletTool
|
||||
from tests.core.fixtures import empty_blockchain # noqa: F401
|
||||
from chia.wallet.cc_wallet.cc_wallet import CCWallet
|
||||
from chia.wallet.transaction_record import TransactionRecord
|
||||
|
@ -16,7 +16,7 @@ from chia.protocols.timelord_protocol import NewInfusionPointVDF
|
||||
from chia.types.blockchain_format.sized_bytes import bytes32
|
||||
from chia.types.unfinished_block import UnfinishedBlock
|
||||
from chia.util.block_cache import BlockCache
|
||||
from tests.block_tools import get_signage_point, BlockTools
|
||||
from chia.util.block_tools import get_signage_point, BlockTools
|
||||
from chia.util.hash import std_hash
|
||||
from chia.util.ints import uint8, uint32, uint64, uint128
|
||||
from tests.core.fixtures import default_1000_blocks, create_blockchain # noqa: F401
|
||||
|
@ -1,14 +1,11 @@
|
||||
import asyncio
|
||||
import logging
|
||||
|
||||
from typing import Dict, List, Optional, Tuple, Callable
|
||||
from time import time
|
||||
from typing import Dict, List, Optional
|
||||
|
||||
import pytest
|
||||
|
||||
import chia.server.ws_connection as ws
|
||||
|
||||
from chia.full_node.mempool import Mempool
|
||||
from chia.full_node.full_node_api import FullNodeAPI
|
||||
from chia.protocols import full_node_protocol
|
||||
from chia.simulator.simulator_protocol import FarmNewBlockProtocol
|
||||
from chia.types.announcement import Announcement
|
||||
@ -21,9 +18,6 @@ from chia.util.clvm import int_to_bytes
|
||||
from chia.util.condition_tools import conditions_for_solution
|
||||
from chia.util.errors import Err
|
||||
from chia.util.ints import uint64
|
||||
from chia.util.hash import std_hash
|
||||
from chia.types.mempool_inclusion_status import MempoolInclusionStatus
|
||||
from chia.util.api_decorators import api_request, peer_required, bytes_required
|
||||
|
||||
from tests.connection_utils import connect_and_get_peer
|
||||
from tests.core.node_height import node_height_at_least
|
||||
@ -101,29 +95,6 @@ class TestMempool:
|
||||
assert spend_bundle is not None
|
||||
|
||||
|
||||
@peer_required
|
||||
@api_request
|
||||
@bytes_required
|
||||
async def respond_transaction(
|
||||
node: FullNodeAPI,
|
||||
tx: full_node_protocol.RespondTransaction,
|
||||
peer: ws.WSChiaConnection,
|
||||
tx_bytes: bytes = b"",
|
||||
test: bool = False,
|
||||
) -> Tuple[MempoolInclusionStatus, Optional[Err]]:
|
||||
"""
|
||||
Receives a full transaction from peer.
|
||||
If tx is added to mempool, send tx_id to others. (new_transaction)
|
||||
"""
|
||||
assert tx_bytes != b""
|
||||
spend_name = std_hash(tx_bytes)
|
||||
if spend_name in node.full_node.full_node_store.pending_tx_request:
|
||||
node.full_node.full_node_store.pending_tx_request.pop(spend_name)
|
||||
if spend_name in node.full_node.full_node_store.peers_with_tx:
|
||||
node.full_node.full_node_store.peers_with_tx.pop(spend_name)
|
||||
return await node.full_node.respond_transaction(tx.transaction, spend_name, peer, test)
|
||||
|
||||
|
||||
class TestMempoolManager:
|
||||
@pytest.mark.asyncio
|
||||
async def test_basic_mempool_manager(self, two_nodes):
|
||||
@ -178,9 +149,7 @@ class TestMempoolManager:
|
||||
|
||||
assert spend_bundle1 is not None
|
||||
tx1: full_node_protocol.RespondTransaction = full_node_protocol.RespondTransaction(spend_bundle1)
|
||||
status, err = await respond_transaction(full_node_1, tx1, peer)
|
||||
assert status == MempoolInclusionStatus.SUCCESS
|
||||
assert err is None
|
||||
await full_node_1.respond_transaction(tx1, peer)
|
||||
|
||||
spend_bundle2 = generate_test_spend_bundle(
|
||||
list(blocks[-1].get_included_reward_coins())[0],
|
||||
@ -188,15 +157,13 @@ class TestMempoolManager:
|
||||
)
|
||||
assert spend_bundle2 is not None
|
||||
tx2: full_node_protocol.RespondTransaction = full_node_protocol.RespondTransaction(spend_bundle2)
|
||||
status, err = await respond_transaction(full_node_1, tx2, peer)
|
||||
await full_node_1.respond_transaction(tx2, peer)
|
||||
|
||||
sb1 = full_node_1.full_node.mempool_manager.get_spendbundle(spend_bundle1.name())
|
||||
sb2 = full_node_1.full_node.mempool_manager.get_spendbundle(spend_bundle2.name())
|
||||
|
||||
assert sb1 == spend_bundle1
|
||||
assert sb2 is None
|
||||
assert status == MempoolInclusionStatus.PENDING
|
||||
assert err == Err.MEMPOOL_CONFLICT
|
||||
|
||||
async def send_sb(self, node, peer, sb):
|
||||
tx = full_node_protocol.RespondTransaction(sb)
|
||||
@ -326,11 +293,125 @@ class TestMempoolManager:
|
||||
|
||||
tx1: full_node_protocol.RespondTransaction = full_node_protocol.RespondTransaction(spend_bundle1)
|
||||
|
||||
status, err = await respond_transaction(full_node_1, tx1, peer)
|
||||
return blocks, spend_bundle1, peer, status, err
|
||||
await full_node_1.respond_transaction(tx1, peer)
|
||||
return blocks, spend_bundle1, peer
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def condition_tester2(self, two_nodes, test_fun: Callable[[Coin, Coin], SpendBundle]):
|
||||
async def test_invalid_block_index(self, two_nodes):
|
||||
|
||||
full_node_1, full_node_2, server_1, server_2 = two_nodes
|
||||
blocks = await full_node_1.get_all_full_blocks()
|
||||
start_height = blocks[-1].height
|
||||
cvp = ConditionWithArgs(
|
||||
ConditionOpcode.ASSERT_HEIGHT_ABSOLUTE,
|
||||
[uint64(start_height + 5).to_bytes(4, "big")],
|
||||
)
|
||||
dic = {ConditionOpcode.ASSERT_HEIGHT_ABSOLUTE: [cvp]}
|
||||
blocks, spend_bundle1, peer = await self.condition_tester(two_nodes, dic)
|
||||
sb1 = full_node_1.full_node.mempool_manager.get_spendbundle(spend_bundle1.name())
|
||||
|
||||
assert sb1 is None
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_correct_block_index(self, two_nodes):
|
||||
|
||||
full_node_1, full_node_2, server_1, server_2 = two_nodes
|
||||
cvp = ConditionWithArgs(ConditionOpcode.ASSERT_HEIGHT_ABSOLUTE, [uint64(1).to_bytes(4, "big")])
|
||||
dic = {ConditionOpcode.ASSERT_HEIGHT_ABSOLUTE: [cvp]}
|
||||
blocks, spend_bundle1, peer = await self.condition_tester(two_nodes, dic)
|
||||
sb1 = full_node_1.full_node.mempool_manager.get_spendbundle(spend_bundle1.name())
|
||||
|
||||
assert sb1 is spend_bundle1
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_invalid_block_age(self, two_nodes):
|
||||
|
||||
full_node_1, full_node_2, server_1, server_2 = two_nodes
|
||||
cvp = ConditionWithArgs(ConditionOpcode.ASSERT_HEIGHT_RELATIVE, [uint64(5).to_bytes(4, "big")])
|
||||
dic = {cvp.opcode: [cvp]}
|
||||
blocks, spend_bundle1, peer = await self.condition_tester(two_nodes, dic)
|
||||
sb1 = full_node_1.full_node.mempool_manager.get_spendbundle(spend_bundle1.name())
|
||||
assert sb1 is None
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_correct_block_age(self, two_nodes):
|
||||
|
||||
full_node_1, full_node_2, server_1, server_2 = two_nodes
|
||||
cvp = ConditionWithArgs(ConditionOpcode.ASSERT_HEIGHT_RELATIVE, [uint64(1).to_bytes(4, "big")])
|
||||
dic = {cvp.opcode: [cvp]}
|
||||
blocks, spend_bundle1, peer = await self.condition_tester(two_nodes, dic, num_blocks=4)
|
||||
|
||||
sb1 = full_node_1.full_node.mempool_manager.get_spendbundle(spend_bundle1.name())
|
||||
|
||||
assert sb1 is spend_bundle1
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_correct_my_id(self, two_nodes):
|
||||
|
||||
full_node_1, full_node_2, server_1, server_2 = two_nodes
|
||||
blocks = await full_node_1.get_all_full_blocks()
|
||||
coin = list(blocks[-1].get_included_reward_coins())[0]
|
||||
cvp = ConditionWithArgs(ConditionOpcode.ASSERT_MY_COIN_ID, [coin.name()])
|
||||
dic = {cvp.opcode: [cvp]}
|
||||
blocks, spend_bundle1, peer = await self.condition_tester(two_nodes, dic, coin=coin)
|
||||
|
||||
sb1 = full_node_1.full_node.mempool_manager.get_spendbundle(spend_bundle1.name())
|
||||
|
||||
assert sb1 is spend_bundle1
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_invalid_my_id(self, two_nodes):
|
||||
|
||||
full_node_1, full_node_2, server_1, server_2 = two_nodes
|
||||
blocks = await full_node_1.get_all_full_blocks()
|
||||
coin = list(blocks[-1].get_included_reward_coins())[0]
|
||||
coin_2 = list(blocks[-2].get_included_reward_coins())[0]
|
||||
cvp = ConditionWithArgs(ConditionOpcode.ASSERT_MY_COIN_ID, [coin_2.name()])
|
||||
dic = {cvp.opcode: [cvp]}
|
||||
blocks, spend_bundle1, peer = await self.condition_tester(two_nodes, dic, coin=coin)
|
||||
|
||||
sb1 = full_node_1.full_node.mempool_manager.get_spendbundle(spend_bundle1.name())
|
||||
|
||||
assert sb1 is None
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_assert_time_exceeds(self, two_nodes):
|
||||
|
||||
full_node_1, full_node_2, server_1, server_2 = two_nodes
|
||||
time_now = uint64(int(time()))
|
||||
|
||||
cvp = ConditionWithArgs(ConditionOpcode.ASSERT_SECONDS_ABSOLUTE, [time_now.to_bytes(8, "big")])
|
||||
dic = {cvp.opcode: [cvp]}
|
||||
blocks, spend_bundle1, peer = await self.condition_tester(two_nodes, dic)
|
||||
sb1 = full_node_1.full_node.mempool_manager.get_spendbundle(spend_bundle1.name())
|
||||
|
||||
assert sb1 is spend_bundle1
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_assert_time_relative_exceeds(self, two_nodes):
|
||||
|
||||
full_node_1, full_node_2, server_1, server_2 = two_nodes
|
||||
time_relative = uint64(3)
|
||||
|
||||
cvp = ConditionWithArgs(ConditionOpcode.ASSERT_SECONDS_RELATIVE, [time_relative.to_bytes(8, "big")])
|
||||
dic = {cvp.opcode: [cvp]}
|
||||
blocks, spend_bundle1, peer = await self.condition_tester(two_nodes, dic)
|
||||
|
||||
sb1 = full_node_1.full_node.mempool_manager.get_spendbundle(spend_bundle1.name())
|
||||
assert sb1 is None
|
||||
|
||||
for i in range(0, 4):
|
||||
await full_node_1.farm_new_transaction_block(FarmNewBlockProtocol(32 * b"0"))
|
||||
|
||||
tx2: full_node_protocol.RespondTransaction = full_node_protocol.RespondTransaction(spend_bundle1)
|
||||
await full_node_1.respond_transaction(tx2, peer)
|
||||
|
||||
sb1 = full_node_1.full_node.mempool_manager.get_spendbundle(spend_bundle1.name())
|
||||
|
||||
assert sb1 is spend_bundle1
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_correct_coin_announcement_consumed(self, two_nodes):
|
||||
reward_ph = WALLET_A.get_new_puzzlehash()
|
||||
full_node_1, full_node_2, server_1, server_2 = two_nodes
|
||||
blocks = await full_node_1.get_all_full_blocks()
|
||||
@ -352,242 +433,68 @@ class TestMempoolManager:
|
||||
coin_1 = list(blocks[-2].get_included_reward_coins())[0]
|
||||
coin_2 = list(blocks[-1].get_included_reward_coins())[0]
|
||||
|
||||
bundle = test_fun(coin_1, coin_2)
|
||||
announce = Announcement(coin_2.name(), bytes("test", "utf-8"))
|
||||
|
||||
cvp = ConditionWithArgs(ConditionOpcode.ASSERT_COIN_ANNOUNCEMENT, [announce.name()])
|
||||
|
||||
dic = {cvp.opcode: [cvp]}
|
||||
|
||||
cvp2 = ConditionWithArgs(ConditionOpcode.CREATE_COIN_ANNOUNCEMENT, [bytes("test", "utf-8")])
|
||||
dic2 = {cvp.opcode: [cvp2]}
|
||||
spend_bundle1 = generate_test_spend_bundle(coin_1, dic)
|
||||
|
||||
spend_bundle2 = generate_test_spend_bundle(coin_2, dic2)
|
||||
|
||||
bundle = SpendBundle.aggregate([spend_bundle1, spend_bundle2])
|
||||
|
||||
tx1: full_node_protocol.RespondTransaction = full_node_protocol.RespondTransaction(bundle)
|
||||
status, err = await respond_transaction(full_node_1, tx1, peer)
|
||||
await full_node_1.respond_transaction(tx1, peer)
|
||||
|
||||
return blocks, bundle, status, err
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_invalid_block_index(self, two_nodes):
|
||||
|
||||
full_node_1, full_node_2, server_1, server_2 = two_nodes
|
||||
blocks = await full_node_1.get_all_full_blocks()
|
||||
start_height = blocks[-1].height
|
||||
cvp = ConditionWithArgs(
|
||||
ConditionOpcode.ASSERT_HEIGHT_ABSOLUTE,
|
||||
[int_to_bytes(start_height + 5)],
|
||||
)
|
||||
dic = {ConditionOpcode.ASSERT_HEIGHT_ABSOLUTE: [cvp]}
|
||||
blocks, spend_bundle1, peer, status, err = await self.condition_tester(two_nodes, dic)
|
||||
sb1 = full_node_1.full_node.mempool_manager.get_spendbundle(spend_bundle1.name())
|
||||
assert sb1 is None
|
||||
# the transaction may become valid later
|
||||
assert status == MempoolInclusionStatus.PENDING
|
||||
assert err == Err.ASSERT_HEIGHT_ABSOLUTE_FAILED
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_correct_block_index(self, two_nodes):
|
||||
|
||||
full_node_1, full_node_2, server_1, server_2 = two_nodes
|
||||
cvp = ConditionWithArgs(ConditionOpcode.ASSERT_HEIGHT_ABSOLUTE, [int_to_bytes(1)])
|
||||
dic = {ConditionOpcode.ASSERT_HEIGHT_ABSOLUTE: [cvp]}
|
||||
blocks, spend_bundle1, peer, status, err = await self.condition_tester(two_nodes, dic)
|
||||
sb1 = full_node_1.full_node.mempool_manager.get_spendbundle(spend_bundle1.name())
|
||||
assert sb1 is spend_bundle1
|
||||
assert status == MempoolInclusionStatus.SUCCESS
|
||||
assert err is None
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_negative_block_index(self, two_nodes):
|
||||
|
||||
full_node_1, full_node_2, server_1, server_2 = two_nodes
|
||||
cvp = ConditionWithArgs(ConditionOpcode.ASSERT_HEIGHT_ABSOLUTE, [int_to_bytes(-1)])
|
||||
dic = {ConditionOpcode.ASSERT_HEIGHT_ABSOLUTE: [cvp]}
|
||||
blocks, spend_bundle1, peer, status, err = await self.condition_tester(two_nodes, dic)
|
||||
sb1 = full_node_1.full_node.mempool_manager.get_spendbundle(spend_bundle1.name())
|
||||
assert sb1 is spend_bundle1
|
||||
assert status == MempoolInclusionStatus.SUCCESS
|
||||
assert err is None
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_invalid_block_age(self, two_nodes):
|
||||
|
||||
full_node_1, full_node_2, server_1, server_2 = two_nodes
|
||||
cvp = ConditionWithArgs(ConditionOpcode.ASSERT_HEIGHT_RELATIVE, [int_to_bytes(5)])
|
||||
dic = {cvp.opcode: [cvp]}
|
||||
blocks, spend_bundle1, peer, status, err = await self.condition_tester(two_nodes, dic)
|
||||
sb1 = full_node_1.full_node.mempool_manager.get_spendbundle(spend_bundle1.name())
|
||||
assert sb1 is None
|
||||
# the transaction may become valid later
|
||||
assert status == MempoolInclusionStatus.PENDING
|
||||
assert err == Err.ASSERT_HEIGHT_RELATIVE_FAILED
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_correct_block_age(self, two_nodes):
|
||||
|
||||
full_node_1, full_node_2, server_1, server_2 = two_nodes
|
||||
cvp = ConditionWithArgs(ConditionOpcode.ASSERT_HEIGHT_RELATIVE, [int_to_bytes(1)])
|
||||
dic = {cvp.opcode: [cvp]}
|
||||
blocks, spend_bundle1, peer, status, err = await self.condition_tester(two_nodes, dic, num_blocks=4)
|
||||
|
||||
sb1 = full_node_1.full_node.mempool_manager.get_spendbundle(spend_bundle1.name())
|
||||
assert sb1 is spend_bundle1
|
||||
assert status == MempoolInclusionStatus.SUCCESS
|
||||
assert err is None
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_negative_block_age(self, two_nodes):
|
||||
|
||||
full_node_1, full_node_2, server_1, server_2 = two_nodes
|
||||
cvp = ConditionWithArgs(ConditionOpcode.ASSERT_HEIGHT_RELATIVE, [int_to_bytes(-1)])
|
||||
dic = {cvp.opcode: [cvp]}
|
||||
blocks, spend_bundle1, peer, status, err = await self.condition_tester(two_nodes, dic, num_blocks=4)
|
||||
|
||||
sb1 = full_node_1.full_node.mempool_manager.get_spendbundle(spend_bundle1.name())
|
||||
assert sb1 is spend_bundle1
|
||||
assert status == MempoolInclusionStatus.SUCCESS
|
||||
assert err is None
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_correct_my_id(self, two_nodes):
|
||||
|
||||
full_node_1, full_node_2, server_1, server_2 = two_nodes
|
||||
blocks = await full_node_1.get_all_full_blocks()
|
||||
coin = list(blocks[-1].get_included_reward_coins())[0]
|
||||
cvp = ConditionWithArgs(ConditionOpcode.ASSERT_MY_COIN_ID, [coin.name()])
|
||||
dic = {cvp.opcode: [cvp]}
|
||||
blocks, spend_bundle1, peer, status, err = await self.condition_tester(two_nodes, dic, coin=coin)
|
||||
|
||||
sb1 = full_node_1.full_node.mempool_manager.get_spendbundle(spend_bundle1.name())
|
||||
assert sb1 is spend_bundle1
|
||||
assert status == MempoolInclusionStatus.SUCCESS
|
||||
assert err is None
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_invalid_my_id(self, two_nodes):
|
||||
|
||||
full_node_1, full_node_2, server_1, server_2 = two_nodes
|
||||
blocks = await full_node_1.get_all_full_blocks()
|
||||
coin = list(blocks[-1].get_included_reward_coins())[0]
|
||||
coin_2 = list(blocks[-2].get_included_reward_coins())[0]
|
||||
cvp = ConditionWithArgs(ConditionOpcode.ASSERT_MY_COIN_ID, [coin_2.name()])
|
||||
dic = {cvp.opcode: [cvp]}
|
||||
blocks, spend_bundle1, peer, status, err = await self.condition_tester(two_nodes, dic, coin=coin)
|
||||
|
||||
sb1 = full_node_1.full_node.mempool_manager.get_spendbundle(spend_bundle1.name())
|
||||
assert sb1 is None
|
||||
assert status == MempoolInclusionStatus.FAILED
|
||||
assert err == Err.ASSERT_MY_COIN_ID_FAILED
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_assert_time_exceeds(self, two_nodes):
|
||||
|
||||
full_node_1, full_node_2, server_1, server_2 = two_nodes
|
||||
# 5 seconds should be before the next block
|
||||
time_now = full_node_1.full_node.blockchain.get_peak().timestamp + 5
|
||||
|
||||
cvp = ConditionWithArgs(ConditionOpcode.ASSERT_SECONDS_ABSOLUTE, [int_to_bytes(time_now)])
|
||||
dic = {cvp.opcode: [cvp]}
|
||||
blocks, spend_bundle1, peer, status, err = await self.condition_tester(two_nodes, dic)
|
||||
sb1 = full_node_1.full_node.mempool_manager.get_spendbundle(spend_bundle1.name())
|
||||
assert sb1 is spend_bundle1
|
||||
assert status == MempoolInclusionStatus.SUCCESS
|
||||
assert err is None
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_assert_time_negative(self, two_nodes):
|
||||
|
||||
full_node_1, full_node_2, server_1, server_2 = two_nodes
|
||||
time_now = -1
|
||||
|
||||
cvp = ConditionWithArgs(ConditionOpcode.ASSERT_SECONDS_ABSOLUTE, [int_to_bytes(time_now)])
|
||||
dic = {cvp.opcode: [cvp]}
|
||||
blocks, spend_bundle1, peer, status, err = await self.condition_tester(two_nodes, dic)
|
||||
sb1 = full_node_1.full_node.mempool_manager.get_spendbundle(spend_bundle1.name())
|
||||
assert sb1 is spend_bundle1
|
||||
assert status == MempoolInclusionStatus.SUCCESS
|
||||
assert err is None
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_assert_time_relative_exceeds(self, two_nodes):
|
||||
|
||||
full_node_1, full_node_2, server_1, server_2 = two_nodes
|
||||
time_relative = 3
|
||||
|
||||
cvp = ConditionWithArgs(ConditionOpcode.ASSERT_SECONDS_RELATIVE, [int_to_bytes(time_relative)])
|
||||
dic = {cvp.opcode: [cvp]}
|
||||
blocks, spend_bundle1, peer, status, err = await self.condition_tester(two_nodes, dic)
|
||||
|
||||
sb1 = full_node_1.full_node.mempool_manager.get_spendbundle(spend_bundle1.name())
|
||||
assert sb1 is None
|
||||
assert status == MempoolInclusionStatus.FAILED
|
||||
assert err == Err.ASSERT_SECONDS_RELATIVE_FAILED
|
||||
|
||||
for i in range(0, 4):
|
||||
await full_node_1.farm_new_transaction_block(FarmNewBlockProtocol(32 * b"0"))
|
||||
|
||||
tx2: full_node_protocol.RespondTransaction = full_node_protocol.RespondTransaction(spend_bundle1)
|
||||
|
||||
status, err = await respond_transaction(full_node_1, tx2, peer)
|
||||
|
||||
sb1 = full_node_1.full_node.mempool_manager.get_spendbundle(spend_bundle1.name())
|
||||
assert sb1 is spend_bundle1
|
||||
assert status == MempoolInclusionStatus.SUCCESS
|
||||
assert err is None
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_assert_time_relative_negative(self, two_nodes):
|
||||
|
||||
full_node_1, full_node_2, server_1, server_2 = two_nodes
|
||||
time_relative = -3
|
||||
|
||||
cvp = ConditionWithArgs(ConditionOpcode.ASSERT_SECONDS_RELATIVE, [int_to_bytes(time_relative)])
|
||||
dic = {cvp.opcode: [cvp]}
|
||||
blocks, spend_bundle1, peer, status, err = await self.condition_tester(two_nodes, dic)
|
||||
|
||||
sb1 = full_node_1.full_node.mempool_manager.get_spendbundle(spend_bundle1.name())
|
||||
assert sb1 is spend_bundle1
|
||||
assert status == MempoolInclusionStatus.SUCCESS
|
||||
assert err is None
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_correct_coin_announcement_consumed(self, two_nodes):
|
||||
def test_fun(coin_1: Coin, coin_2: Coin) -> SpendBundle:
|
||||
announce = Announcement(coin_2.name(), b"test")
|
||||
cvp = ConditionWithArgs(ConditionOpcode.ASSERT_COIN_ANNOUNCEMENT, [announce.name()])
|
||||
dic = {cvp.opcode: [cvp]}
|
||||
|
||||
cvp2 = ConditionWithArgs(ConditionOpcode.CREATE_COIN_ANNOUNCEMENT, [b"test"])
|
||||
dic2 = {cvp.opcode: [cvp2]}
|
||||
spend_bundle1 = generate_test_spend_bundle(coin_1, dic)
|
||||
spend_bundle2 = generate_test_spend_bundle(coin_2, dic2)
|
||||
bundle = SpendBundle.aggregate([spend_bundle1, spend_bundle2])
|
||||
return bundle
|
||||
|
||||
full_node_1, full_node_2, server_1, server_2 = two_nodes
|
||||
blocks, bundle, status, err = await self.condition_tester2(two_nodes, test_fun)
|
||||
mempool_bundle = full_node_1.full_node.mempool_manager.get_spendbundle(bundle.name())
|
||||
|
||||
assert mempool_bundle is bundle
|
||||
assert status == MempoolInclusionStatus.SUCCESS
|
||||
assert err is None
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_coin_announcement_too_big(self, two_nodes):
|
||||
reward_ph = WALLET_A.get_new_puzzlehash()
|
||||
full_node_1, full_node_2, server_1, server_2 = two_nodes
|
||||
blocks = await full_node_1.get_all_full_blocks()
|
||||
start_height = blocks[-1].height if len(blocks) > 0 else -1
|
||||
blocks = bt.get_consecutive_blocks(
|
||||
3,
|
||||
block_list_input=blocks,
|
||||
guarantee_transaction_block=True,
|
||||
farmer_reward_puzzle_hash=reward_ph,
|
||||
pool_reward_puzzle_hash=reward_ph,
|
||||
)
|
||||
peer = await connect_and_get_peer(server_1, server_2)
|
||||
|
||||
def test_fun(coin_1: Coin, coin_2: Coin):
|
||||
announce = Announcement(coin_2.name(), bytes([1] * 10000))
|
||||
for block in blocks:
|
||||
await full_node_1.full_node.respond_block(full_node_protocol.RespondBlock(block))
|
||||
|
||||
cvp = ConditionWithArgs(ConditionOpcode.ASSERT_COIN_ANNOUNCEMENT, [announce.name()])
|
||||
await time_out_assert(60, node_height_at_least, True, full_node_1, start_height + 3)
|
||||
|
||||
dic = {cvp.opcode: [cvp]}
|
||||
coin_1 = list(blocks[-2].get_included_reward_coins())[0]
|
||||
coin_2 = list(blocks[-1].get_included_reward_coins())[0]
|
||||
|
||||
cvp2 = ConditionWithArgs(ConditionOpcode.CREATE_COIN_ANNOUNCEMENT, [b"test"])
|
||||
dic2 = {cvp.opcode: [cvp2]}
|
||||
spend_bundle1 = generate_test_spend_bundle(coin_1, dic)
|
||||
announce = Announcement(coin_2.name(), bytes([1] * 10000))
|
||||
|
||||
spend_bundle2 = generate_test_spend_bundle(coin_2, dic2)
|
||||
cvp = ConditionWithArgs(ConditionOpcode.ASSERT_COIN_ANNOUNCEMENT, [announce.name()])
|
||||
|
||||
return SpendBundle.aggregate([spend_bundle1, spend_bundle2])
|
||||
dic = {cvp.opcode: [cvp]}
|
||||
|
||||
blocks, bundle, status, err = await self.condition_tester2(two_nodes, test_fun)
|
||||
cvp2 = ConditionWithArgs(ConditionOpcode.CREATE_COIN_ANNOUNCEMENT, [bytes("test", "utf-8")])
|
||||
dic2 = {cvp.opcode: [cvp2]}
|
||||
spend_bundle1 = generate_test_spend_bundle(coin_1, dic)
|
||||
|
||||
spend_bundle2 = generate_test_spend_bundle(coin_2, dic2)
|
||||
|
||||
bundle = SpendBundle.aggregate([spend_bundle1, spend_bundle2])
|
||||
|
||||
tx1: full_node_protocol.RespondTransaction = full_node_protocol.RespondTransaction(bundle)
|
||||
await full_node_1.respond_transaction(tx1, peer)
|
||||
|
||||
assert full_node_1.full_node.mempool_manager.get_spendbundle(bundle.name()) is None
|
||||
assert status == MempoolInclusionStatus.FAILED
|
||||
assert err == Err.ASSERT_ANNOUNCE_CONSUMED_FAILED
|
||||
|
||||
blocks = bt.get_consecutive_blocks(
|
||||
1, block_list_input=blocks, guarantee_transaction_block=True, transaction_data=bundle
|
||||
@ -600,150 +507,236 @@ class TestMempoolManager:
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_invalid_coin_announcement_rejected(self, two_nodes):
|
||||
reward_ph = WALLET_A.get_new_puzzlehash()
|
||||
full_node_1, full_node_2, server_1, server_2 = two_nodes
|
||||
blocks = await full_node_1.get_all_full_blocks()
|
||||
start_height = blocks[-1].height if len(blocks) > 0 else -1
|
||||
blocks = bt.get_consecutive_blocks(
|
||||
3,
|
||||
block_list_input=blocks,
|
||||
guarantee_transaction_block=True,
|
||||
farmer_reward_puzzle_hash=reward_ph,
|
||||
pool_reward_puzzle_hash=reward_ph,
|
||||
)
|
||||
peer = await connect_and_get_peer(server_1, server_2)
|
||||
|
||||
def test_fun(coin_1: Coin, coin_2: Coin):
|
||||
announce = Announcement(coin_2.name(), b"test")
|
||||
for block in blocks:
|
||||
await full_node_1.full_node.respond_block(full_node_protocol.RespondBlock(block))
|
||||
|
||||
cvp = ConditionWithArgs(ConditionOpcode.ASSERT_COIN_ANNOUNCEMENT, [announce.name()])
|
||||
await time_out_assert(60, node_height_at_least, True, full_node_1, start_height + 3)
|
||||
|
||||
dic = {cvp.opcode: [cvp]}
|
||||
# Wrong message
|
||||
cvp2 = ConditionWithArgs(
|
||||
ConditionOpcode.CREATE_COIN_ANNOUNCEMENT,
|
||||
[b"wrong test"],
|
||||
)
|
||||
dic2 = {cvp.opcode: [cvp2]}
|
||||
spend_bundle1 = generate_test_spend_bundle(coin_1, dic)
|
||||
coin_1 = list(blocks[-2].get_included_reward_coins())[0]
|
||||
coin_2 = list(blocks[-1].get_included_reward_coins())[0]
|
||||
|
||||
spend_bundle2 = generate_test_spend_bundle(coin_2, dic2)
|
||||
announce = Announcement(coin_2.name(), bytes("test", "utf-8"))
|
||||
|
||||
return SpendBundle.aggregate([spend_bundle1, spend_bundle2])
|
||||
cvp = ConditionWithArgs(ConditionOpcode.ASSERT_COIN_ANNOUNCEMENT, [announce.name()])
|
||||
|
||||
blocks, bundle, status, err = await self.condition_tester2(two_nodes, test_fun)
|
||||
dic = {cvp.opcode: [cvp]}
|
||||
# Wrong message
|
||||
cvp2 = ConditionWithArgs(
|
||||
ConditionOpcode.CREATE_COIN_ANNOUNCEMENT,
|
||||
[bytes("wrong test", "utf-8")],
|
||||
)
|
||||
dic2 = {cvp.opcode: [cvp2]}
|
||||
spend_bundle1 = generate_test_spend_bundle(coin_1, dic)
|
||||
|
||||
spend_bundle2 = generate_test_spend_bundle(coin_2, dic2)
|
||||
|
||||
bundle = SpendBundle.aggregate([spend_bundle1, spend_bundle2])
|
||||
|
||||
tx1: full_node_protocol.RespondTransaction = full_node_protocol.RespondTransaction(spend_bundle1)
|
||||
await full_node_1.respond_transaction(tx1, peer)
|
||||
|
||||
mempool_bundle = full_node_1.full_node.mempool_manager.get_spendbundle(bundle.name())
|
||||
|
||||
assert mempool_bundle is None
|
||||
assert status == MempoolInclusionStatus.FAILED
|
||||
assert err == Err.ASSERT_ANNOUNCE_CONSUMED_FAILED
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_invalid_coin_announcement_rejected_two(self, two_nodes):
|
||||
reward_ph = WALLET_A.get_new_puzzlehash()
|
||||
full_node_1, full_node_2, server_1, server_2 = two_nodes
|
||||
blocks = await full_node_1.get_all_full_blocks()
|
||||
start_height = blocks[-1].height if len(blocks) > 0 else -1
|
||||
blocks = bt.get_consecutive_blocks(
|
||||
3,
|
||||
block_list_input=blocks,
|
||||
guarantee_transaction_block=True,
|
||||
farmer_reward_puzzle_hash=reward_ph,
|
||||
pool_reward_puzzle_hash=reward_ph,
|
||||
)
|
||||
peer = await connect_and_get_peer(server_1, server_2)
|
||||
|
||||
def test_fun(coin_1: Coin, coin_2: Coin):
|
||||
announce = Announcement(coin_1.name(), b"test")
|
||||
for block in blocks:
|
||||
await full_node_1.full_node.respond_block(full_node_protocol.RespondBlock(block))
|
||||
|
||||
cvp = ConditionWithArgs(ConditionOpcode.ASSERT_COIN_ANNOUNCEMENT, [announce.name()])
|
||||
await time_out_assert(60, node_height_at_least, True, full_node_1, start_height + 3)
|
||||
|
||||
dic = {cvp.opcode: [cvp]}
|
||||
coin_1 = list(blocks[-2].get_included_reward_coins())[0]
|
||||
coin_2 = list(blocks[-1].get_included_reward_coins())[0]
|
||||
|
||||
cvp2 = ConditionWithArgs(
|
||||
ConditionOpcode.CREATE_COIN_ANNOUNCEMENT,
|
||||
[b"test"],
|
||||
)
|
||||
dic2 = {cvp.opcode: [cvp2]}
|
||||
spend_bundle1 = generate_test_spend_bundle(coin_1, dic)
|
||||
announce = Announcement(coin_1.name(), bytes("test", "utf-8"))
|
||||
|
||||
# coin 2 is making the announcement, right message wrong coin
|
||||
spend_bundle2 = generate_test_spend_bundle(coin_2, dic2)
|
||||
cvp = ConditionWithArgs(ConditionOpcode.ASSERT_COIN_ANNOUNCEMENT, [announce.name()])
|
||||
|
||||
return SpendBundle.aggregate([spend_bundle1, spend_bundle2])
|
||||
dic = {cvp.opcode: [cvp]}
|
||||
|
||||
cvp2 = ConditionWithArgs(
|
||||
ConditionOpcode.CREATE_COIN_ANNOUNCEMENT,
|
||||
[bytes("test", "utf-8")],
|
||||
)
|
||||
dic2 = {cvp.opcode: [cvp2]}
|
||||
spend_bundle1 = generate_test_spend_bundle(coin_1, dic)
|
||||
|
||||
# coin 2 is making the announcement, right message wrong coin
|
||||
spend_bundle2 = generate_test_spend_bundle(coin_2, dic2)
|
||||
|
||||
bundle = SpendBundle.aggregate([spend_bundle1, spend_bundle2])
|
||||
|
||||
tx1: full_node_protocol.RespondTransaction = full_node_protocol.RespondTransaction(spend_bundle1)
|
||||
await full_node_1.respond_transaction(tx1, peer)
|
||||
|
||||
blocks, bundle, status, err = await self.condition_tester2(two_nodes, test_fun)
|
||||
mempool_bundle = full_node_1.full_node.mempool_manager.get_spendbundle(bundle.name())
|
||||
|
||||
assert mempool_bundle is None
|
||||
assert status == MempoolInclusionStatus.FAILED
|
||||
assert err == Err.ASSERT_ANNOUNCE_CONSUMED_FAILED
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_correct_puzzle_announcement(self, two_nodes):
|
||||
reward_ph = WALLET_A.get_new_puzzlehash()
|
||||
full_node_1, full_node_2, server_1, server_2 = two_nodes
|
||||
blocks = await full_node_1.get_all_full_blocks()
|
||||
start_height = blocks[-1].height if len(blocks) > 0 else -1
|
||||
blocks = bt.get_consecutive_blocks(
|
||||
3,
|
||||
block_list_input=blocks,
|
||||
guarantee_transaction_block=True,
|
||||
farmer_reward_puzzle_hash=reward_ph,
|
||||
pool_reward_puzzle_hash=reward_ph,
|
||||
)
|
||||
peer = await connect_and_get_peer(server_1, server_2)
|
||||
|
||||
def test_fun(coin_1: Coin, coin_2: Coin):
|
||||
announce = Announcement(coin_2.puzzle_hash, bytes(0x80))
|
||||
for block in blocks:
|
||||
await full_node_1.full_node.respond_block(full_node_protocol.RespondBlock(block))
|
||||
|
||||
cvp = ConditionWithArgs(ConditionOpcode.ASSERT_PUZZLE_ANNOUNCEMENT, [announce.name()])
|
||||
await time_out_assert(60, node_height_at_least, True, full_node_1, start_height + 3)
|
||||
|
||||
dic = {cvp.opcode: [cvp]}
|
||||
coin_1 = list(blocks[-2].get_included_reward_coins())[0]
|
||||
coin_2 = list(blocks[-1].get_included_reward_coins())[0]
|
||||
|
||||
cvp2 = ConditionWithArgs(ConditionOpcode.CREATE_PUZZLE_ANNOUNCEMENT, [bytes(0x80)])
|
||||
dic2 = {cvp.opcode: [cvp2]}
|
||||
spend_bundle1 = generate_test_spend_bundle(coin_1, dic)
|
||||
announce = Announcement(coin_2.puzzle_hash, bytes(0x80))
|
||||
|
||||
spend_bundle2 = generate_test_spend_bundle(coin_2, dic2)
|
||||
cvp = ConditionWithArgs(ConditionOpcode.ASSERT_PUZZLE_ANNOUNCEMENT, [announce.name()])
|
||||
|
||||
return SpendBundle.aggregate([spend_bundle1, spend_bundle2])
|
||||
dic = {cvp.opcode: [cvp]}
|
||||
|
||||
blocks, bundle, status, err = await self.condition_tester2(two_nodes, test_fun)
|
||||
cvp2 = ConditionWithArgs(ConditionOpcode.CREATE_PUZZLE_ANNOUNCEMENT, [bytes(0x80)])
|
||||
dic2 = {cvp.opcode: [cvp2]}
|
||||
spend_bundle1 = generate_test_spend_bundle(coin_1, dic)
|
||||
|
||||
spend_bundle2 = generate_test_spend_bundle(coin_2, dic2)
|
||||
|
||||
bundle = SpendBundle.aggregate([spend_bundle1, spend_bundle2])
|
||||
|
||||
tx1: full_node_protocol.RespondTransaction = full_node_protocol.RespondTransaction(bundle)
|
||||
await full_node_1.respond_transaction(tx1, peer)
|
||||
|
||||
mempool_bundle = full_node_1.full_node.mempool_manager.get_spendbundle(bundle.name())
|
||||
|
||||
assert mempool_bundle is bundle
|
||||
assert status == MempoolInclusionStatus.SUCCESS
|
||||
assert err is None
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_invalid_puzzle_announcement_rejected(self, two_nodes):
|
||||
reward_ph = WALLET_A.get_new_puzzlehash()
|
||||
full_node_1, full_node_2, server_1, server_2 = two_nodes
|
||||
blocks = await full_node_1.get_all_full_blocks()
|
||||
start_height = blocks[-1].height if len(blocks) > 0 else -1
|
||||
blocks = bt.get_consecutive_blocks(
|
||||
3,
|
||||
block_list_input=blocks,
|
||||
guarantee_transaction_block=True,
|
||||
farmer_reward_puzzle_hash=reward_ph,
|
||||
pool_reward_puzzle_hash=reward_ph,
|
||||
)
|
||||
peer = await connect_and_get_peer(server_1, server_2)
|
||||
|
||||
def test_fun(coin_1: Coin, coin_2: Coin):
|
||||
announce = Announcement(coin_2.puzzle_hash, bytes("test", "utf-8"))
|
||||
for block in blocks:
|
||||
await full_node_1.full_node.respond_block(full_node_protocol.RespondBlock(block))
|
||||
|
||||
cvp = ConditionWithArgs(ConditionOpcode.ASSERT_PUZZLE_ANNOUNCEMENT, [announce.name()])
|
||||
await time_out_assert(60, node_height_at_least, True, full_node_1, start_height + 3)
|
||||
|
||||
dic = {cvp.opcode: [cvp]}
|
||||
coin_1 = list(blocks[-2].get_included_reward_coins())[0]
|
||||
coin_2 = list(blocks[-1].get_included_reward_coins())[0]
|
||||
|
||||
cvp2 = ConditionWithArgs(
|
||||
ConditionOpcode.CREATE_PUZZLE_ANNOUNCEMENT,
|
||||
[b"wrong test"],
|
||||
)
|
||||
dic2 = {cvp.opcode: [cvp2]}
|
||||
spend_bundle1 = generate_test_spend_bundle(coin_1, dic)
|
||||
announce = Announcement(coin_2.puzzle_hash, bytes("test", "utf-8"))
|
||||
|
||||
spend_bundle2 = generate_test_spend_bundle(coin_2, dic2)
|
||||
cvp = ConditionWithArgs(ConditionOpcode.ASSERT_PUZZLE_ANNOUNCEMENT, [announce.name()])
|
||||
|
||||
return SpendBundle.aggregate([spend_bundle1, spend_bundle2])
|
||||
dic = {cvp.opcode: [cvp]}
|
||||
|
||||
blocks, bundle, status, err = await self.condition_tester2(two_nodes, test_fun)
|
||||
cvp2 = ConditionWithArgs(
|
||||
ConditionOpcode.CREATE_PUZZLE_ANNOUNCEMENT,
|
||||
[bytes("wrong test", "utf-8")],
|
||||
)
|
||||
dic2 = {cvp.opcode: [cvp2]}
|
||||
spend_bundle1 = generate_test_spend_bundle(coin_1, dic)
|
||||
|
||||
spend_bundle2 = generate_test_spend_bundle(coin_2, dic2)
|
||||
|
||||
bundle = SpendBundle.aggregate([spend_bundle1, spend_bundle2])
|
||||
|
||||
tx1: full_node_protocol.RespondTransaction = full_node_protocol.RespondTransaction(spend_bundle1)
|
||||
await full_node_1.respond_transaction(tx1, peer)
|
||||
|
||||
mempool_bundle = full_node_1.full_node.mempool_manager.get_spendbundle(bundle.name())
|
||||
|
||||
assert mempool_bundle is None
|
||||
assert status == MempoolInclusionStatus.FAILED
|
||||
assert err == Err.ASSERT_ANNOUNCE_CONSUMED_FAILED
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_invalid_puzzle_announcement_rejected_two(self, two_nodes):
|
||||
reward_ph = WALLET_A.get_new_puzzlehash()
|
||||
full_node_1, full_node_2, server_1, server_2 = two_nodes
|
||||
blocks = await full_node_1.get_all_full_blocks()
|
||||
start_height = blocks[-1].height if len(blocks) > 0 else -1
|
||||
blocks = bt.get_consecutive_blocks(
|
||||
3,
|
||||
block_list_input=blocks,
|
||||
guarantee_transaction_block=True,
|
||||
farmer_reward_puzzle_hash=reward_ph,
|
||||
pool_reward_puzzle_hash=reward_ph,
|
||||
)
|
||||
peer = await connect_and_get_peer(server_1, server_2)
|
||||
|
||||
def test_fun(coin_1: Coin, coin_2: Coin):
|
||||
announce = Announcement(coin_2.puzzle_hash, b"test")
|
||||
for block in blocks:
|
||||
await full_node_1.full_node.respond_block(full_node_protocol.RespondBlock(block))
|
||||
|
||||
cvp = ConditionWithArgs(ConditionOpcode.ASSERT_PUZZLE_ANNOUNCEMENT, [announce.name()])
|
||||
await time_out_assert(60, node_height_at_least, True, full_node_1, start_height + 3)
|
||||
|
||||
dic = {cvp.opcode: [cvp]}
|
||||
# Wrong type of Create_announcement
|
||||
cvp2 = ConditionWithArgs(
|
||||
ConditionOpcode.CREATE_COIN_ANNOUNCEMENT,
|
||||
[b"test"],
|
||||
)
|
||||
dic2 = {cvp.opcode: [cvp2]}
|
||||
spend_bundle1 = generate_test_spend_bundle(coin_1, dic)
|
||||
coin_1 = list(blocks[-2].get_included_reward_coins())[0]
|
||||
coin_2 = list(blocks[-1].get_included_reward_coins())[0]
|
||||
|
||||
spend_bundle2 = generate_test_spend_bundle(coin_2, dic2)
|
||||
announce = Announcement(coin_2.puzzle_hash, bytes("test", "utf-8"))
|
||||
|
||||
return SpendBundle.aggregate([spend_bundle1, spend_bundle2])
|
||||
cvp = ConditionWithArgs(ConditionOpcode.ASSERT_PUZZLE_ANNOUNCEMENT, [announce.name()])
|
||||
|
||||
blocks, bundle, status, err = await self.condition_tester2(two_nodes, test_fun)
|
||||
dic = {cvp.opcode: [cvp]}
|
||||
# Wrong type of Create_announcement
|
||||
cvp2 = ConditionWithArgs(
|
||||
ConditionOpcode.CREATE_COIN_ANNOUNCEMENT,
|
||||
[bytes("test", "utf-8")],
|
||||
)
|
||||
dic2 = {cvp.opcode: [cvp2]}
|
||||
spend_bundle1 = generate_test_spend_bundle(coin_1, dic)
|
||||
|
||||
spend_bundle2 = generate_test_spend_bundle(coin_2, dic2)
|
||||
|
||||
bundle = SpendBundle.aggregate([spend_bundle1, spend_bundle2])
|
||||
|
||||
tx1: full_node_protocol.RespondTransaction = full_node_protocol.RespondTransaction(spend_bundle1)
|
||||
await full_node_1.respond_transaction(tx1, peer)
|
||||
|
||||
mempool_bundle = full_node_1.full_node.mempool_manager.get_spendbundle(bundle.name())
|
||||
|
||||
assert mempool_bundle is None
|
||||
assert status == MempoolInclusionStatus.FAILED
|
||||
assert err == Err.ASSERT_ANNOUNCE_CONSUMED_FAILED
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_assert_fee_condition(self, two_nodes):
|
||||
@ -751,35 +744,17 @@ class TestMempoolManager:
|
||||
full_node_1, full_node_2, server_1, server_2 = two_nodes
|
||||
cvp = ConditionWithArgs(ConditionOpcode.RESERVE_FEE, [int_to_bytes(10)])
|
||||
dic = {cvp.opcode: [cvp]}
|
||||
blocks, spend_bundle1, peer, status, err = await self.condition_tester(two_nodes, dic, fee=10)
|
||||
blocks, spend_bundle1, peer = await self.condition_tester(two_nodes, dic, fee=10)
|
||||
mempool_bundle = full_node_1.full_node.mempool_manager.get_spendbundle(spend_bundle1.name())
|
||||
|
||||
assert mempool_bundle is not None
|
||||
assert status == MempoolInclusionStatus.SUCCESS
|
||||
assert err is None
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_assert_fee_condition_negative_fee(self, two_nodes):
|
||||
full_node_1, full_node_2, server_1, server_2 = two_nodes
|
||||
cvp = ConditionWithArgs(ConditionOpcode.RESERVE_FEE, [int_to_bytes(-1)])
|
||||
dic = {cvp.opcode: [cvp]}
|
||||
blocks, spend_bundle1, peer, status, err = await self.condition_tester(two_nodes, dic, fee=10)
|
||||
assert status == MempoolInclusionStatus.FAILED
|
||||
assert err == Err.RESERVE_FEE_CONDITION_FAILED
|
||||
blocks = bt.get_consecutive_blocks(
|
||||
1, block_list_input=blocks, guarantee_transaction_block=True, transaction_data=spend_bundle1
|
||||
)
|
||||
assert full_node_1.full_node.mempool_manager.get_spendbundle(spend_bundle1.name()) is None
|
||||
assert (await full_node_1.full_node.blockchain.receive_block(blocks[-1]))[1] == Err.RESERVE_FEE_CONDITION_FAILED
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_assert_fee_condition_fee_too_large(self, two_nodes):
|
||||
full_node_1, full_node_2, server_1, server_2 = two_nodes
|
||||
cvp = ConditionWithArgs(ConditionOpcode.RESERVE_FEE, [int_to_bytes(2 ** 64)])
|
||||
dic = {cvp.opcode: [cvp]}
|
||||
blocks, spend_bundle1, peer, status, err = await self.condition_tester(two_nodes, dic, fee=10)
|
||||
assert status == MempoolInclusionStatus.FAILED
|
||||
assert err == Err.RESERVE_FEE_CONDITION_FAILED
|
||||
blocks, spend_bundle1, peer = await self.condition_tester(two_nodes, dic, fee=10)
|
||||
blocks = bt.get_consecutive_blocks(
|
||||
1, block_list_input=blocks, guarantee_transaction_block=True, transaction_data=spend_bundle1
|
||||
)
|
||||
@ -793,12 +768,10 @@ class TestMempoolManager:
|
||||
|
||||
cvp = ConditionWithArgs(ConditionOpcode.RESERVE_FEE, [int_to_bytes(10)])
|
||||
dic = {cvp.opcode: [cvp]}
|
||||
blocks, spend_bundle1, peer, status, err = await self.condition_tester(two_nodes, dic, fee=9)
|
||||
blocks, spend_bundle1, peer = await self.condition_tester(two_nodes, dic, fee=9)
|
||||
mempool_bundle = full_node_1.full_node.mempool_manager.get_spendbundle(spend_bundle1.name())
|
||||
|
||||
assert mempool_bundle is None
|
||||
assert status == MempoolInclusionStatus.FAILED
|
||||
assert err == Err.RESERVE_FEE_CONDITION_FAILED
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_stealing_fee(self, two_nodes):
|
||||
@ -849,13 +822,11 @@ class TestMempoolManager:
|
||||
|
||||
tx1: full_node_protocol.RespondTransaction = full_node_protocol.RespondTransaction(spend_bundle1)
|
||||
|
||||
status, err = await respond_transaction(full_node_1, tx1, peer)
|
||||
await full_node_1.respond_transaction(tx1, peer)
|
||||
|
||||
mempool_bundle = full_node_1.full_node.mempool_manager.get_spendbundle(spend_bundle1.name())
|
||||
|
||||
assert mempool_bundle is None
|
||||
assert status == MempoolInclusionStatus.FAILED
|
||||
assert err == Err.RESERVE_FEE_CONDITION_FAILED
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_double_spend_same_bundle(self, two_nodes):
|
||||
@ -892,12 +863,10 @@ class TestMempoolManager:
|
||||
|
||||
tx: full_node_protocol.RespondTransaction = full_node_protocol.RespondTransaction(spend_bundle_combined)
|
||||
|
||||
status, err = await respond_transaction(full_node_1, tx, peer)
|
||||
await full_node_1.respond_transaction(tx, peer)
|
||||
|
||||
sb = full_node_1.full_node.mempool_manager.get_spendbundle(spend_bundle_combined.name())
|
||||
assert sb is None
|
||||
assert status == MempoolInclusionStatus.FAILED
|
||||
assert err == Err.DOUBLE_SPEND
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_agg_sig_condition(self, two_nodes):
|
||||
@ -957,13 +926,11 @@ class TestMempoolManager:
|
||||
coin = list(blocks[-1].get_included_reward_coins())[0]
|
||||
cvp = ConditionWithArgs(ConditionOpcode.ASSERT_MY_PARENT_ID, [coin.parent_coin_info])
|
||||
dic = {cvp.opcode: [cvp]}
|
||||
blocks, spend_bundle1, peer, status, err = await self.condition_tester(two_nodes, dic, coin=coin)
|
||||
blocks, spend_bundle1, peer = await self.condition_tester(two_nodes, dic, coin=coin)
|
||||
|
||||
sb1 = full_node_1.full_node.mempool_manager.get_spendbundle(spend_bundle1.name())
|
||||
|
||||
assert sb1 is spend_bundle1
|
||||
assert status == MempoolInclusionStatus.SUCCESS
|
||||
assert err is None
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_invalid_my_parent(self, two_nodes):
|
||||
@ -974,13 +941,11 @@ class TestMempoolManager:
|
||||
coin_2 = list(blocks[-2].get_included_reward_coins())[0]
|
||||
cvp = ConditionWithArgs(ConditionOpcode.ASSERT_MY_PARENT_ID, [coin_2.parent_coin_info])
|
||||
dic = {cvp.opcode: [cvp]}
|
||||
blocks, spend_bundle1, peer, status, err = await self.condition_tester(two_nodes, dic, coin=coin)
|
||||
blocks, spend_bundle1, peer = await self.condition_tester(two_nodes, dic, coin=coin)
|
||||
|
||||
sb1 = full_node_1.full_node.mempool_manager.get_spendbundle(spend_bundle1.name())
|
||||
|
||||
assert sb1 is None
|
||||
assert status == MempoolInclusionStatus.FAILED
|
||||
assert err == Err.ASSERT_MY_PARENT_ID_FAILED
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_correct_my_puzhash(self, two_nodes):
|
||||
@ -990,13 +955,11 @@ class TestMempoolManager:
|
||||
coin = list(blocks[-1].get_included_reward_coins())[0]
|
||||
cvp = ConditionWithArgs(ConditionOpcode.ASSERT_MY_PUZZLEHASH, [coin.puzzle_hash])
|
||||
dic = {cvp.opcode: [cvp]}
|
||||
blocks, spend_bundle1, peer, status, err = await self.condition_tester(two_nodes, dic, coin=coin)
|
||||
blocks, spend_bundle1, peer = await self.condition_tester(two_nodes, dic, coin=coin)
|
||||
|
||||
sb1 = full_node_1.full_node.mempool_manager.get_spendbundle(spend_bundle1.name())
|
||||
|
||||
assert sb1 is spend_bundle1
|
||||
assert status == MempoolInclusionStatus.SUCCESS
|
||||
assert err is None
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_invalid_my_puzhash(self, two_nodes):
|
||||
@ -1006,13 +969,11 @@ class TestMempoolManager:
|
||||
coin = list(blocks[-1].get_included_reward_coins())[0]
|
||||
cvp = ConditionWithArgs(ConditionOpcode.ASSERT_MY_PUZZLEHASH, [Program.to([]).get_tree_hash()])
|
||||
dic = {cvp.opcode: [cvp]}
|
||||
blocks, spend_bundle1, peer, status, err = await self.condition_tester(two_nodes, dic, coin=coin)
|
||||
blocks, spend_bundle1, peer = await self.condition_tester(two_nodes, dic, coin=coin)
|
||||
|
||||
sb1 = full_node_1.full_node.mempool_manager.get_spendbundle(spend_bundle1.name())
|
||||
|
||||
assert sb1 is None
|
||||
assert status == MempoolInclusionStatus.FAILED
|
||||
assert err == Err.ASSERT_MY_PUZZLEHASH_FAILED
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_correct_my_amount(self, two_nodes):
|
||||
@ -1020,57 +981,24 @@ class TestMempoolManager:
|
||||
full_node_1, full_node_2, server_1, server_2 = two_nodes
|
||||
blocks = await full_node_1.get_all_full_blocks()
|
||||
coin = list(blocks[-1].get_included_reward_coins())[0]
|
||||
cvp = ConditionWithArgs(ConditionOpcode.ASSERT_MY_AMOUNT, [int_to_bytes(coin.amount)])
|
||||
cvp = ConditionWithArgs(ConditionOpcode.ASSERT_MY_AMOUNT, [coin.amount])
|
||||
dic = {cvp.opcode: [cvp]}
|
||||
blocks, spend_bundle1, peer, status, err = await self.condition_tester(two_nodes, dic, coin=coin)
|
||||
blocks, spend_bundle1, peer = await self.condition_tester(two_nodes, dic, coin=coin)
|
||||
|
||||
sb1 = full_node_1.full_node.mempool_manager.get_spendbundle(spend_bundle1.name())
|
||||
|
||||
assert sb1 is spend_bundle1
|
||||
assert status == MempoolInclusionStatus.SUCCESS
|
||||
assert err is None
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_invalid_my_amount(self, two_nodes):
|
||||
|
||||
full_node_1, full_node_2, server_1, server_2 = two_nodes
|
||||
blocks = await full_node_1.get_all_full_blocks()
|
||||
cvp = ConditionWithArgs(ConditionOpcode.ASSERT_MY_AMOUNT, [int_to_bytes(1000)])
|
||||
coin = list(blocks[-1].get_included_reward_coins())[0]
|
||||
cvp = ConditionWithArgs(ConditionOpcode.ASSERT_MY_AMOUNT, [1000])
|
||||
dic = {cvp.opcode: [cvp]}
|
||||
blocks, spend_bundle1, peer, status, err = await self.condition_tester(two_nodes, dic)
|
||||
blocks, spend_bundle1, peer = await self.condition_tester(two_nodes, dic, coin=coin)
|
||||
|
||||
sb1 = full_node_1.full_node.mempool_manager.get_spendbundle(spend_bundle1.name())
|
||||
|
||||
assert sb1 is None
|
||||
assert status == MempoolInclusionStatus.FAILED
|
||||
assert err == Err.ASSERT_MY_AMOUNT_FAILED
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_negative_my_amount(self, two_nodes):
|
||||
|
||||
full_node_1, full_node_2, server_1, server_2 = two_nodes
|
||||
blocks = await full_node_1.get_all_full_blocks()
|
||||
cvp = ConditionWithArgs(ConditionOpcode.ASSERT_MY_AMOUNT, [int_to_bytes(-1)])
|
||||
dic = {cvp.opcode: [cvp]}
|
||||
blocks, spend_bundle1, peer, status, err = await self.condition_tester(two_nodes, dic)
|
||||
|
||||
sb1 = full_node_1.full_node.mempool_manager.get_spendbundle(spend_bundle1.name())
|
||||
|
||||
assert sb1 is None
|
||||
assert status == MempoolInclusionStatus.FAILED
|
||||
assert err == Err.ASSERT_MY_AMOUNT_FAILED
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_my_amount_too_large(self, two_nodes):
|
||||
|
||||
full_node_1, full_node_2, server_1, server_2 = two_nodes
|
||||
blocks = await full_node_1.get_all_full_blocks()
|
||||
cvp = ConditionWithArgs(ConditionOpcode.ASSERT_MY_AMOUNT, [int_to_bytes(2 ** 64)])
|
||||
dic = {cvp.opcode: [cvp]}
|
||||
blocks, spend_bundle1, peer, status, err = await self.condition_tester(two_nodes, dic)
|
||||
|
||||
sb1 = full_node_1.full_node.mempool_manager.get_spendbundle(spend_bundle1.name())
|
||||
|
||||
assert sb1 is None
|
||||
assert status == MempoolInclusionStatus.FAILED
|
||||
assert err == Err.ASSERT_MY_AMOUNT_FAILED
|
||||
|
@ -17,7 +17,7 @@ from chia.types.condition_with_args import ConditionWithArgs
|
||||
from chia.types.unfinished_block import UnfinishedBlock
|
||||
from chia.util.clvm import int_to_bytes
|
||||
from chia.util.ints import uint64
|
||||
from tests.wallet_tools import WalletTool
|
||||
from chia.util.wallet_tools import WalletTool
|
||||
from tests.core.fixtures import empty_blockchain # noqa: F401
|
||||
|
||||
from tests.connection_utils import add_dummy_connection, connect_and_get_peer
|
||||
|
@ -9,7 +9,7 @@ from chia.server.server import ChiaServer, ssl_context_for_client
|
||||
from chia.server.ws_connection import WSChiaConnection
|
||||
from chia.ssl.create_ssl import generate_ca_signed_cert
|
||||
from chia.types.peer_info import PeerInfo
|
||||
from tests.block_tools import test_constants
|
||||
from chia.util.block_tools import test_constants
|
||||
from chia.util.ints import uint16
|
||||
from tests.setup_nodes import (
|
||||
bt,
|
||||
|
@ -16,7 +16,7 @@ from chia.rpc.harvester_rpc_client import HarvesterRpcClient
|
||||
from chia.rpc.rpc_server import start_rpc_server
|
||||
from chia.types.blockchain_format.sized_bytes import bytes32
|
||||
from chia.util.bech32m import decode_puzzle_hash, encode_puzzle_hash
|
||||
from tests.block_tools import get_plot_dir
|
||||
from chia.util.block_tools import get_plot_dir
|
||||
from chia.util.byte_types import hexstr_to_bytes
|
||||
from chia.util.config import load_config, save_config
|
||||
from chia.util.hash import std_hash
|
||||
|
@ -16,7 +16,7 @@ from chia.types.unfinished_block import UnfinishedBlock
|
||||
from chia.util.block_tools import get_signage_point
|
||||
from chia.util.hash import std_hash
|
||||
from chia.util.ints import uint16, uint8
|
||||
from tests.wallet_tools import WalletTool
|
||||
from chia.util.wallet_tools import WalletTool
|
||||
from tests.connection_utils import connect_and_get_peer
|
||||
from tests.setup_nodes import bt, self_hostname, setup_simulators_and_wallets, test_constants
|
||||
from tests.time_out_assert import time_out_assert
|
||||
|
@ -18,7 +18,7 @@ from chia.simulator.start_simulator import service_kwargs_for_full_node_simulato
|
||||
from chia.timelord.timelord_launcher import kill_processes, spawn_process
|
||||
from chia.types.peer_info import PeerInfo
|
||||
from chia.util.bech32m import encode_puzzle_hash
|
||||
from tests.block_tools import BlockTools, test_constants
|
||||
from chia.util.block_tools import BlockTools, test_constants
|
||||
from chia.util.hash import std_hash
|
||||
from chia.util.ints import uint16, uint32
|
||||
from chia.util.keychain import Keychain, bytes_to_mnemonic
|
||||
|
@ -1,7 +1,7 @@
|
||||
import pytest
|
||||
|
||||
from chia.types.peer_info import PeerInfo
|
||||
from tests.block_tools import BlockTools
|
||||
from chia.util.block_tools import BlockTools
|
||||
from chia.util.ints import uint16
|
||||
from tests.core.node_height import node_height_at_least
|
||||
from tests.setup_nodes import self_hostname, setup_full_node, setup_full_system, test_constants
|
||||
|
@ -9,7 +9,7 @@ from chia.types.blockchain_format.program import Program, INFINITE_COST
|
||||
from chia.types.condition_opcodes import ConditionOpcode
|
||||
from chia.types.condition_with_args import ConditionWithArgs
|
||||
from chia.util.ints import uint32
|
||||
from tests.wallet_tools import WalletTool
|
||||
from chia.util.wallet_tools import WalletTool
|
||||
from chia.wallet.derive_keys import master_sk_to_wallet_sk
|
||||
from chia.wallet.puzzles.p2_delegated_puzzle import puzzle_for_pk
|
||||
|
||||
|
@ -6,7 +6,7 @@ from chia.types.blockchain_format.sized_bytes import bytes32
|
||||
from chia.types.coin_solution import CoinSolution
|
||||
from chia.util.condition_tools import conditions_by_opcode, conditions_for_solution, pkm_pairs_for_conditions_dict
|
||||
from tests.core.make_block_generator import GROUP_ORDER, int_to_public_key
|
||||
from tests.block_tools import test_constants
|
||||
from chia.util.block_tools import test_constants
|
||||
|
||||
|
||||
class KeyTool(dict):
|
||||
|
@ -1,4 +1,5 @@
|
||||
import asyncio
|
||||
import time
|
||||
from pathlib import Path
|
||||
from secrets import token_bytes
|
||||
|
||||
@ -11,8 +12,6 @@ from chia.wallet.cc_wallet.cc_wallet import CCWallet
|
||||
from chia.wallet.trade_manager import TradeManager
|
||||
from chia.wallet.trading.trade_status import TradeStatus
|
||||
from tests.setup_nodes import setup_simulators_and_wallets
|
||||
from tests.time_out_assert import time_out_assert
|
||||
from tests.wallet.sync.test_wallet_sync import wallet_height_at_least
|
||||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
@ -21,6 +20,19 @@ def event_loop():
|
||||
yield loop
|
||||
|
||||
|
||||
async def time_out_assert(timeout: int, function, value, arg=None):
|
||||
start = time.time()
|
||||
while time.time() - start < timeout:
|
||||
if arg is None:
|
||||
function_result = await function()
|
||||
else:
|
||||
function_result = await function(arg)
|
||||
if value == function_result:
|
||||
return None
|
||||
await asyncio.sleep(2)
|
||||
assert False
|
||||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
async def two_wallet_nodes():
|
||||
async for _ in setup_simulators_and_wallets(1, 2, {}):
|
||||
@ -74,7 +86,7 @@ class TestCCTrades:
|
||||
|
||||
for i in range(1, buffer_blocks):
|
||||
await full_node.farm_new_transaction_block(FarmNewBlockProtocol(token_bytes()))
|
||||
await time_out_assert(15, wallet_height_at_least, True, wallet_node_0, 27)
|
||||
|
||||
await time_out_assert(15, cc_wallet.get_confirmed_balance, 100)
|
||||
await time_out_assert(15, cc_wallet.get_unconfirmed_balance, 100)
|
||||
|
||||
@ -89,14 +101,13 @@ class TestCCTrades:
|
||||
|
||||
for i in range(0, buffer_blocks):
|
||||
await full_node.farm_new_transaction_block(FarmNewBlockProtocol(token_bytes()))
|
||||
await time_out_assert(15, wallet_height_at_least, True, wallet_node_0, 31)
|
||||
|
||||
# send cc_wallet 2 a coin
|
||||
cc_hash = await cc_wallet_2.get_new_inner_hash()
|
||||
tx_record = await cc_wallet.generate_signed_transaction([uint64(1)], [cc_hash])
|
||||
await wallet_0.wallet_state_manager.add_pending_transaction(tx_record)
|
||||
for i in range(0, buffer_blocks):
|
||||
await full_node.farm_new_transaction_block(FarmNewBlockProtocol(token_bytes()))
|
||||
await time_out_assert(15, wallet_height_at_least, True, wallet_node_0, 35)
|
||||
|
||||
trade_manager_0 = wallet_node_0.wallet_state_manager.trade_manager
|
||||
trade_manager_1 = wallet_node_1.wallet_state_manager.trade_manager
|
||||
@ -130,7 +141,6 @@ class TestCCTrades:
|
||||
for i in range(0, buffer_blocks):
|
||||
await full_node.farm_new_transaction_block(FarmNewBlockProtocol(token_bytes()))
|
||||
|
||||
await time_out_assert(15, wallet_height_at_least, True, wallet_node_0, 39)
|
||||
await time_out_assert(15, cc_wallet_2.get_confirmed_balance, 31)
|
||||
await time_out_assert(15, cc_wallet_2.get_unconfirmed_balance, 31)
|
||||
trade_2 = await trade_manager_0.get_trade_by_id(trade_offer.trade_id)
|
||||
|
@ -13,7 +13,6 @@ from chia.util.ints import uint16
|
||||
from chia.wallet.util.wallet_types import WalletType
|
||||
from tests.setup_nodes import self_hostname, setup_simulators_and_wallets
|
||||
from tests.time_out_assert import time_out_assert
|
||||
from tests.wallet.sync.test_wallet_sync import wallet_height_at_least
|
||||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
@ -158,7 +157,7 @@ class TestRLWallet:
|
||||
await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(32 * b"\0"))
|
||||
await time_out_assert(15, check_balance, 90, api_user, user_wallet_id)
|
||||
await time_out_assert(15, receiving_wallet.get_spendable_balance, 108)
|
||||
await time_out_assert(15, wallet_height_at_least, True, wallet_node, 72)
|
||||
|
||||
val = await api_admin.send_clawback_transaction({"wallet_id": admin_wallet_id, "fee": 11})
|
||||
await time_out_assert(15, is_transaction_in_mempool, True, api_admin, val["transaction_id"])
|
||||
for i in range(0, num_blocks):
|
||||
|
@ -18,7 +18,7 @@ from chia.server.start_full_node import SERVICE_NAME
|
||||
from chia.types.blockchain_format.sized_bytes import bytes32
|
||||
from chia.types.blockchain_format.sub_epoch_summary import SubEpochSummary
|
||||
from chia.util.block_cache import BlockCache
|
||||
from tests.block_tools import test_constants
|
||||
from chia.util.block_tools import test_constants
|
||||
from chia.util.config import load_config
|
||||
from chia.util.default_root import DEFAULT_ROOT_PATH
|
||||
from chia.util.generator_tools import get_block_header
|
||||
|
Loading…
Reference in New Issue
Block a user