développement de base de bitcoin : tant de "références non définies" après avoir ajouté quelques codes, comment le résoudre ?
Fermé. Cette question est hors sujet. Il n’accepte actuellement pas de réponses.
Vous voulez améliorer cette question ? Mettez à jour la question afin qu’elle soit d’actualité pour Bitcoin Stack Exchange.
Fermé il y a 3 heures.
Je veux juste modifier l’algorithme de hachage de bitcoin-0.20 et je veux remplacer l’algorithme de hachage précédent par l’algorithme x13hash. Je modifie donc la source ci-dessous,
1, j’ajoute les fichiers x13hash au bitcoin-0.20/src/crypto/x13hash, il y a des fichiers ci-dessous :
c bmwc keccakh sph_cubehashh sph_hamsish sph_sph_shavite.sh
h sph_echoh sph_jhh sph_simd
2, j’ajoute une nouvelle fonction dans block.h ci-dessous
classe CBlockHeader
Publique :
// entête
uint256 hashPrevBlock;
uint256 hashMerkleRoot;
CBlockHeader()
SetNull();
modèle
READWRITE(this->nVersion);
READWRITE(hachageBlocPrécédent);
READWRITE(hachageMerkleRoot);
READWRITE(nHeure);
READWRITE(nBits);
READWRITE(nNonce);
annuler SetNull()
nVersion = 0 ;
hashPrevBlock.SetNull();
hashMerkleRoot.SetNull();
nHeure = 0 ;
nBits = 0 ;
nNon = 0 ;
bool IsNull() const
retour (nBits == 0);
uint256 GetHash() const;
uint256 GetNewPoWHash() const; //nouvelle fonction de hachage
3, ajoutez la fonction dans block.cpp
#comprendre
#comprendre
#define BEGIN(a) ((char*)&(a))
#define END(a) ((char*)&((&(a))))
#define UBEGIN(a) ((caractère non signé*)&(a))
#define UEND(a) ((caractère non signé*)&((&(a))))
#define ARRAYLEN(tableau) (taillede(tableau)/taillede((tableau)))
uint256 CBlockHeader ::GetHash() const
return SerializeHash(*this);
uint256 CBlockHeader ::GetNewPoWHash() const //nouveau ! !
return HashX13sm3(BEGIN(nVersion), END(nNonce));
#comprendre
// ajout de nouveau
h »
h »
h »
h »
h »
h »
h »
h »
h »
h »
h »
h »
h »
h »
#ifdef GLOBALDEFINED
#définir GLOBAL
#autre
#define GLOBAL externe
#fin si
typedef uint256 ChainCode;
modèle
inline uint256 HashX13 (const T1 pbegin, const T1 pend)
caractère statique non signé pblank;
//std ::string strhash;
//strhash = « »;
#fin si
hachage uint256;
(pbegin == pend (pend – pbegin) * sizeof(pbegin));
static_cast(&hacher));
static_cast(&hacher), 64);
static_cast(&hacher));
static_cast(&hacher), 64);
static_cast(&hacher));
static_cast(&hacher), 64);
static_cast(&hacher));
static_cast(&hacher), 64);
static_cast(&hacher));
static_cast(&hacher), 64);
static_cast(&hacher));
static_cast(&hacher), 64);
static_cast(&hacher));
static_cast(&hacher), 64);
static_cast(&hacher));
static_cast(&hacher), 64);
static_cast(&hacher));
static_cast(&hacher), 64);
static_cast(&hacher));
static_cast(&hacher), 64);
static_cast(&hacher));
static_cast(&hacher), 64);
static_cast(&hacher));
static_cast(&hacher), 64);
static_cast(&hacher));
retour de hachage;
modèle
inline uint256 HashX13sm3 (const T1 pbegin, const T1 pend)
caractère statique non signé pblank;
//std ::string strhash;
//strhash = « »;
#fin si
hachage uint256;
(pbegin == pend (pend – pbegin) * sizeof(pbegin));
static_cast(&hacher));
static_cast(&hacher), 64);
static_cast(&hacher));
static_cast(&hacher), 64);
static_cast(&hacher));
static_cast(&hacher), 64);
static_cast(&hacher));
static_cast(&hacher), 64);
static_cast(&hacher));
static_cast(&hacher), 64);
static_cast(&hacher));
hacher.SetNull(); //sm3 est de 256 bits, juste au cas où
hacher.SetNull();
static_cast(&hacher), 64);
static_cast(&hacher));
static_cast(&hacher), 64);
static_cast(&hacher));
static_cast(&hacher), 64);
static_cast(&hacher));
static_cast(&hacher), 64);
static_cast(&hacher));
static_cast(&hacher), 64);
static_cast(&hacher));
static_cast(&hacher), 64);
static_cast(&hacher));
static_cast(&hacher), 64);
static_cast(&hacher));
retour de hachage;
typedef uint256 ChainCode;
Enfin, je recommence, cela montre l’erreur ci-dessous:
o
o
o
o
a
a
a
a
CXXLD libbitcoinconsensus.la
a
a
a
CXXLD bitcoin-cli
CXXLD bitcoin-tx
Portefeuille bitcoin CXXLD
Bitcoin CXXLD
a(libbitcoin_consensus_a-block.o) : dans la fonction `uint256 HashX13sm3(car*, car*)’ :
collect2 : erreur : ld a renvoyé 1 état de sortie
Fabriquer : *** Erreur 1
Fabriquer : *** En attente de travaux inachevés.
a(libbitcoin_consensus_a-block.o) : dans la fonction `uint256 HashX13sm3(car*, car*)’ :
collect2 : erreur : ld a renvoyé 1 état de sortie
Fabriquer : *** Erreur 1
a(libbitcoin_consensus_a-block.o) : dans la fonction `uint256 HashX13sm3(car*, car*)’ :
collect2 : erreur : ld a renvoyé 1 état de sortie
Fabriquer : *** Erreur 1
a(libbitcoin_consensus_a-block.o) : dans la fonction `uint256 HashX13sm3(car*, car*)’ :
/usr/bin/ld : /home/gilsun91/bitcoin-0.20/src/./hash.h:230 : référence non définie à `sph_fugue512_close’