Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to insert user in database for testing backend? #16

Closed
frndxyz opened this issue Jan 25, 2017 · 1 comment
Closed

how to insert user in database for testing backend? #16

frndxyz opened this issue Jan 25, 2017 · 1 comment
Labels

Comments

@frndxyz
Copy link

frndxyz commented Jan 25, 2017

No description provided.

@SwimmingTiger
Copy link
Contributor

SwimmingTiger commented Feb 8, 2017

There is no user database in the project. You may design any type of user database by yourself. And write a get-user-list web api to expose all username-uid pairs to pool's stratum server.

Only the username-uid pairs from the web api is needed for the pool backend.

For test, you may write a small script with static user list. There is an example:

get-user-list.php

<?php
header('Content-Type: application/json');

$last_id = (int) $_GET['last_id'];

$users = [
    'aaa' => 1,
    'bbb' => 2,
    'xxx' => 3,
    'mmm' => 4,
    'vvv' => 5,
    'ddd' => 6,
];

$requestedUsers = [];
foreach ($users as $name=>$id) {
    if ($id > $last_id) {
        $requestedUsers [$name] = $id;
    }
}

echo json_encode(
    [
        'err_no' => 0,
        'err_msg' => null,
        'data' => (object) $requestedUsers,
    ]
);

Then put it in a httpd server and edit /work/btcpool/build/run_sserver/sserver.cfg:

list_id_api_url = "http://localhost/get-user-list.php";

Then you can mining for aaa, bbb or xxx, etc. Its id 1, 2 or 3 will be recorded to tables in bpool_local_stats_db as column puid .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants