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

Comments

Projects
None yet
4 participants
@frndxyz
Copy link

frndxyz commented Jan 25, 2017

No description provided.

@SwimmingTiger

This comment has been minimized.

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 .

@bitkevin bitkevin closed this May 3, 2017

@YihaoPeng YihaoPeng added the question label Oct 22, 2018

bmhjyu added a commit that referenced this issue Apr 15, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.