[Python] Algorand: TransactionPool.Remember: TransactionPool.ingest: no pending block evaluator

Discussão em 'Python' iniciado por Stack, Abril 15, 2025.

  1. Stack

    Stack Membro Participativo

    I am currently trying out Algorand, with the intention of self-hosting a completely new network with just a single command.

    You can try it out via

    $ git clone https://github.com/hermesloom/algorand-node-fly
    $ cd algorand-node-fly
    $ local/setup.sh 10000 EUR


    The last step of the setup script is that it is running the unit tests from test.py in that repository, particularly this one:

    def test_04_transfer_funds(self):
    """Test transferring funds from genesis to a new test account."""
    try:
    # Create a test account to transfer funds to
    test_account = self.create_test_account()

    # Transfer funds from genesis to test account
    result = self.api_client.transfer(
    self.genesis_address,
    self.genesis_mnemonic,
    test_account["address"],
    self.test_transfer_amount,
    "Test transfer",
    )

    # Check result
    self.assertIn("tx_id", result)
    self.assertIn("status", result)
    tx_id = result["tx_id"]

    print(f"Transfer initiated with transaction ID: {tx_id}")

    # If status is pending, wait briefly for confirmation
    if result["status"] == "pending":
    print("Transaction pending, waiting 5 seconds for confirmation...")
    time.sleep(5)

    # Verify the balance was received by checking the test account
    account_info = self.api_client.get_balance(
    test_account["address"], test_account["mnemonic"]
    )

    self.assertIn("balance", account_info)
    balance = account_info["balance"]

    # The test account should have the transferred amount (or potentially more)
    self.assertGreaterEqual(
    balance,
    self.test_transfer_amount,
    f"Test account balance {balance} is less than transfer amount {self.test_transfer_amount}",
    )

    print(f"Test account received {balance} picoXDRs")

    except Exception as e:
    self.fail(f"Failed to transfer funds and verify: {e}")


    The transfer endpoint uses algosdk like this:

    @app.route("/api/transfer", methods=["POST"])
    def transfer_funds():
    """Transfer funds from one account to another with mnemonic authentication."""
    # Basic rate limiting
    client_ip = request.remote_addr
    if rate_limit(client_ip):
    return jsonify({"error": "Rate limit exceeded"}), 429

    try:
    data = request.get_json()
    sender_address = data.get("from")
    sender_mnemonic = data.get("mnemonic")
    receiver_address = data.get("to")
    amount = data.get("amount")
    note = data.get("note", "")

    # Validate inputs
    if not all([sender_address, sender_mnemonic, receiver_address, amount]):
    return jsonify({"error": "Missing required fields"}), 400

    try:
    amount = int(amount)
    if amount <= 0:
    raise ValueError("Amount must be positive")
    except ValueError:
    return jsonify({"error": "Invalid amount"}), 400

    # Validate mnemonic corresponds to sender address
    if not validate_mnemonic(sender_mnemonic, sender_address):
    return jsonify({"error": "Invalid mnemonic for sender address"}), 403

    # Convert mnemonic to private key
    sender_private_key = mnemonic.to_private_key(sender_mnemonic)

    # Get transaction parameters
    params = algod_client.suggested_params()

    # Create and sign transaction
    unsigned_txn = PaymentTxn(
    sender=sender_address,
    sp=params,
    receiver=receiver_address,
    amt=amount,
    note=note.encode() if note else None,
    )

    signed_txn = unsigned_txn.sign(sender_private_key)

    # Submit transaction
    tx_id = algod_client.send_transaction(signed_txn)

    # Wait for confirmation
    try:
    wait_for_confirmation(algod_client, tx_id)
    return jsonify({"tx_id": tx_id, "status": "confirmed"})
    except Exception as e:
    return jsonify({"tx_id": tx_id, "status": "pending", "error": str(e)}), 202

    except Exception as e:
    app.logger.error(f"Error transferring funds: {e}")
    return jsonify({"error": f"Failed to transfer funds: {str(e)}"}), 500


    And when I run the unit test, I get this error:

    FAIL: test_04_transfer_funds (__main__.AlgorandAPITest.test_04_transfer_funds)
    Test transferring funds from genesis to a new test account.
    ----------------------------------------------------------------------
    Traceback (most recent call last):
    File "/Users/nalenz/Programmierung/algorand-node-fly/local/test.py", line 222, in test_04_transfer_funds
    result = self.api_client.transfer(
    self.genesis_address,
    ...<3 lines>...
    "Test transfer",
    )
    File "/Users/nalenz/Programmierung/algorand-node-fly/local/api_client.py", line 70, in transfer
    raise Exception(f"Error transferring funds: {response.text}")
    Exception: Error transferring funds: {"error":"Failed to transfer funds: TransactionPool.Remember: TransactionPool.ingest: no pending block evaluator"}


    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
    File "/Users/nalenz/Programmierung/algorand-node-fly/local/test.py", line 260, in test_04_transfer_funds
    self.fail(f"Failed to transfer funds and verify: {e}")
    ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    AssertionError: Failed to transfer funds and verify: Error transferring funds: {"error":"Failed to transfer funds: TransactionPool.Remember: TransactionPool.ingest: no pending block evaluator"}


    How can this "no pending block evaluator" issue be fixed?

    Continue reading...

Compartilhe esta Página