Skip to content

Commit

Permalink
ghost
Browse files Browse the repository at this point in the history
  • Loading branch information
Lbqds committed Nov 27, 2023
1 parent 46e0c40 commit 0d1b82a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/messages.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,13 @@ typedef struct job_t {
int from_group;
int to_group;
blob_t header_blob;
blob_t txs_blob;
blob_t body_blob;
blob_t target;
} job_t;

void free_job(job_t *job) {
free_blob(&job->header_blob);
free_blob(&job->txs_blob);
free_blob(&job->body_blob);
free_blob(&job->target);
free(job);
}
Expand Down Expand Up @@ -216,7 +216,7 @@ void extract_job(uint8_t **bytes, job_t *job)
job->to_group = extract_size(bytes);
// LOG("group: %d, %d\n", job->from_group, job->to_group);
extract_blob(bytes, &job->header_blob);
extract_blob(bytes, &job->txs_blob);
extract_blob(bytes, &job->body_blob);
extract_blob(bytes, &job->target);
}

Expand Down
4 changes: 2 additions & 2 deletions src/worker.h
Original file line number Diff line number Diff line change
Expand Up @@ -183,15 +183,15 @@ ssize_t write_new_block(mining_worker_t *worker, uint8_t *write_buf) {
: worker->host_hasher.ref_hasher->buf;
uint8_t *write_pos = write_buf;

ssize_t block_size = 24 + job->header_blob.len + job->txs_blob.len;
ssize_t block_size = 24 + job->header_blob.len + job->body_blob.len;
ssize_t message_size = 1 + 4 + block_size;

write_size(&write_pos, message_size);
write_byte(&write_pos, 0); // message type
write_size(&write_pos, block_size);
write_bytes(&write_pos, nonce, 24);
write_blob(&write_pos, &job->header_blob);
write_blob(&write_pos, &job->txs_blob);
write_blob(&write_pos, &job->body_blob);

return message_size + 4;
}
Expand Down

0 comments on commit 0d1b82a

Please sign in to comment.