mirror of
https://github.com/GOSTSec/poolserver
synced 2025-02-11 14:34:15 +00:00
Updated for Peercoin
This commit is contained in:
parent
0fccd298c6
commit
4931afd7ed
@ -61,7 +61,7 @@ void NetworkMgr::UpdateBlockTemplate()
|
|||||||
|
|
||||||
// Add coinbase tx
|
// Add coinbase tx
|
||||||
BinaryData pubkey = Util::ASCIIToBin(sConfig.Get<std::string>("MiningAddress"));
|
BinaryData pubkey = Util::ASCIIToBin(sConfig.Get<std::string>("MiningAddress"));
|
||||||
block->tx.push_back(Bitcoin::CreateCoinbaseTX(_blockHeight, pubkey, response["coinbasevalue"].GetInt()));
|
block->tx.push_back(Bitcoin::CreateCoinbaseTX(_blockHeight, pubkey, response["coinbasevalue"].GetInt(), Util::ASCIIToBin("D7PoolBeta")));
|
||||||
|
|
||||||
// Add other transactions
|
// Add other transactions
|
||||||
JSON trans = response["transactions"];
|
JSON trans = response["transactions"];
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
#include "VarInt.h"
|
#include "VarInt.h"
|
||||||
#include "Script.h"
|
#include "Script.h"
|
||||||
#include "BigNum.h"
|
#include "BigNum.h"
|
||||||
|
#include "Util.h"
|
||||||
#include <gmpxx.h>
|
#include <gmpxx.h>
|
||||||
|
|
||||||
namespace Bitcoin
|
namespace Bitcoin
|
||||||
@ -31,12 +32,12 @@ namespace Bitcoin
|
|||||||
return BigInt(bits & 0xFFFFFF) * BigInt(power);
|
return BigInt(bits & 0xFFFFFF) * BigInt(power);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline Transaction CreateCoinbaseTX(uint32 blockHeight, BinaryData pubkey, int64 value)
|
inline Transaction CreateCoinbaseTX(uint32 blockHeight, BinaryData pubkey, int64 value, BinaryData extras)
|
||||||
{
|
{
|
||||||
// Extranonce placeholder
|
// Extranonce placeholder
|
||||||
BinaryData extranonce_ph(8, 0);
|
BinaryData extranonce_ph(8, 0);
|
||||||
ByteBuffer scriptsig;
|
ByteBuffer scriptsig;
|
||||||
scriptsig << blockHeight << extranonce_ph;
|
scriptsig << blockHeight << extranonce_ph << extras;
|
||||||
|
|
||||||
Bitcoin::OutPoint outpoint;
|
Bitcoin::OutPoint outpoint;
|
||||||
outpoint.hash.resize(32, 0);
|
outpoint.hash.resize(32, 0);
|
||||||
@ -53,6 +54,7 @@ namespace Bitcoin
|
|||||||
|
|
||||||
Transaction tx;
|
Transaction tx;
|
||||||
tx.version = 1;
|
tx.version = 1;
|
||||||
|
tx.time = Util:Date();
|
||||||
tx.in.push_back(txin);
|
tx.in.push_back(txin);
|
||||||
tx.out.push_back(txout);
|
tx.out.push_back(txout);
|
||||||
tx.lockTime = 0;
|
tx.lockTime = 0;
|
||||||
|
@ -18,6 +18,7 @@ namespace Bitcoin
|
|||||||
uint32 time;
|
uint32 time;
|
||||||
uint32 bits;
|
uint32 bits;
|
||||||
uint32 nonce;
|
uint32 nonce;
|
||||||
|
BinaryData signature;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Block : public BlockHeader
|
class Block : public BlockHeader
|
||||||
|
@ -100,6 +100,7 @@ ByteBuffer& Bitcoin::operator>>(ByteBuffer& a, TxOut& b)
|
|||||||
ByteBuffer& Bitcoin::operator<<(ByteBuffer& a, Transaction& b)
|
ByteBuffer& Bitcoin::operator<<(ByteBuffer& a, Transaction& b)
|
||||||
{
|
{
|
||||||
a << b.version;
|
a << b.version;
|
||||||
|
a << b.time;
|
||||||
|
|
||||||
// Inputs
|
// Inputs
|
||||||
VarInt insize(b.in.size());
|
VarInt insize(b.in.size());
|
||||||
@ -120,6 +121,7 @@ ByteBuffer& Bitcoin::operator<<(ByteBuffer& a, Transaction& b)
|
|||||||
ByteBuffer& Bitcoin::operator>>(ByteBuffer& a, Transaction& b)
|
ByteBuffer& Bitcoin::operator>>(ByteBuffer& a, Transaction& b)
|
||||||
{
|
{
|
||||||
a >> b.version;
|
a >> b.version;
|
||||||
|
a >> b.time;
|
||||||
|
|
||||||
// Inputs
|
// Inputs
|
||||||
VarInt insize;
|
VarInt insize;
|
||||||
@ -158,6 +160,8 @@ ByteBuffer& Bitcoin::operator<<(ByteBuffer& a, Block& b)
|
|||||||
for (uint64 i = 0; i < txcount; ++i)
|
for (uint64 i = 0; i < txcount; ++i)
|
||||||
a << b.tx[i];
|
a << b.tx[i];
|
||||||
|
|
||||||
|
a << b.signature;
|
||||||
|
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
ByteBuffer& Bitcoin::operator>>(ByteBuffer& a, Block& b)
|
ByteBuffer& Bitcoin::operator>>(ByteBuffer& a, Block& b)
|
||||||
@ -176,5 +180,7 @@ ByteBuffer& Bitcoin::operator>>(ByteBuffer& a, Block& b)
|
|||||||
for (uint64 i = 0; i < txcount; ++i)
|
for (uint64 i = 0; i < txcount; ++i)
|
||||||
a >> b.tx[i];
|
a >> b.tx[i];
|
||||||
|
|
||||||
|
a >> b.signature;
|
||||||
|
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
@ -47,6 +47,7 @@ namespace Bitcoin
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
uint32 version;
|
uint32 version;
|
||||||
|
uint32 time;
|
||||||
std::vector<TxIn> in;
|
std::vector<TxIn> in;
|
||||||
std::vector<TxOut> out;
|
std::vector<TxOut> out;
|
||||||
uint32 lockTime;
|
uint32 lockTime;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user