Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
defunctec
crown-core
Commits
763de7c6
Commit
763de7c6
authored
4 years ago
by
Ashot Khachatryan
Browse files
Options
Download
Email Patches
Plain Diff
Fixed auxpow validation
parent
1aca86ed
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/masternodeman.cpp
+1
-1
src/masternodeman.cpp
src/primitives/transaction.cpp
+5
-5
src/primitives/transaction.cpp
src/primitives/transaction.h
+12
-5
src/primitives/transaction.h
with
18 additions
and
11 deletions
+18
-11
src/masternodeman.cpp
View file @
763de7c6
...
...
@@ -573,7 +573,7 @@ void CMasternodeMan::ProcessMessage(CNode* pfrom, const std::string& strCommand,
mapSeenMasternodePing
.
insert
(
make_pair
(
mnp
.
GetHash
(),
mnp
));
int
nDoS
=
0
;
LOCK
(
cs_main
);
//
LOCK(cs_main);
if
(
mnp
.
CheckAndUpdate
(
nDoS
))
return
;
if
(
nDoS
>
0
)
{
...
...
This diff is collapsed.
Click to expand it.
src/primitives/transaction.cpp
View file @
763de7c6
...
...
@@ -64,8 +64,8 @@ std::string CTxOut::ToString() const
return
strprintf
(
"CTxOut(nValue=%d.%08d, scriptPubKey=%s)"
,
nValue
/
COIN
,
nValue
%
COIN
,
HexStr
(
scriptPubKey
).
substr
(
0
,
30
));
}
CMutableTransaction
::
CMutableTransaction
()
:
nVersion
(
CTransaction
::
CURRENT_VERSION
),
nLockTime
(
0
)
{}
CMutableTransaction
::
CMutableTransaction
(
const
CTransaction
&
tx
)
:
vin
(
tx
.
vin
),
vout
(
tx
.
vout
),
nVersion
(
tx
.
nVersion
),
nLockTime
(
tx
.
nLockTime
),
extraPayload
(
tx
.
extraPayload
)
{}
CMutableTransaction
::
CMutableTransaction
()
:
nVersion
(
CTransaction
::
CURRENT_VERSION
),
nType
(
TRANSACTION_NORMAL
),
nLockTime
(
0
)
{}
CMutableTransaction
::
CMutableTransaction
(
const
CTransaction
&
tx
)
:
vin
(
tx
.
vin
),
vout
(
tx
.
vout
),
nVersion
(
tx
.
nVersion
),
nType
(
tx
.
nType
),
nLockTime
(
tx
.
nLockTime
),
extraPayload
(
tx
.
extraPayload
)
{}
uint256
CMutableTransaction
::
GetHash
()
const
{
...
...
@@ -87,11 +87,11 @@ uint256 CTransaction::ComputeWitnessHash() const
/* For backward compatibility, the hash is initialized to 0. TODO: remove the need for this default constructor entirely. */
CTransaction
::
CTransaction
()
:
vin
(),
vout
(),
nVersion
(
CTransaction
::
CURRENT_VERSION
),
nType
(
TRANSACTION_NORMAL
),
nLockTime
(
0
),
hash
{},
m_witness_hash
{}
{}
CTransaction
::
CTransaction
(
const
CMutableTransaction
&
tx
)
:
vin
(
tx
.
vin
),
vout
(
tx
.
vout
),
nVersion
(
tx
.
nVersion
),
nType
(
TRANSACTION_NORMAL
),
nLockTime
(
tx
.
nLockTime
),
extraPayload
(
tx
.
extraPayload
),
hash
{
ComputeHash
()},
m_witness_hash
{
ComputeWitnessHash
()}
{}
CTransaction
::
CTransaction
(
CMutableTransaction
&&
tx
)
:
vin
(
std
::
move
(
tx
.
vin
)),
vout
(
std
::
move
(
tx
.
vout
)),
nVersion
(
tx
.
nVersion
),
nType
(
TRANSACTION_NORMAL
),
nLockTime
(
tx
.
nLockTime
),
extraPayload
(
tx
.
extraPayload
),
hash
{
ComputeHash
()},
m_witness_hash
{
ComputeWitnessHash
()}
{}
CTransaction
::
CTransaction
(
const
CMutableTransaction
&
tx
)
:
vin
(
tx
.
vin
),
vout
(
tx
.
vout
),
nVersion
(
tx
.
nVersion
),
nType
(
tx
.
nType
),
nLockTime
(
tx
.
nLockTime
),
extraPayload
(
tx
.
extraPayload
),
hash
{
ComputeHash
()},
m_witness_hash
{
ComputeWitnessHash
()}
{
ComputeHash
();
}
CTransaction
::
CTransaction
(
CMutableTransaction
&&
tx
)
:
vin
(
std
::
move
(
tx
.
vin
)),
vout
(
std
::
move
(
tx
.
vout
)),
nVersion
(
tx
.
nVersion
),
nType
(
tx
.
nType
),
nLockTime
(
tx
.
nLockTime
),
extraPayload
(
tx
.
extraPayload
),
hash
{
ComputeHash
()},
m_witness_hash
{
ComputeWitnessHash
()}
{
ComputeHash
();
}
CTransaction
&
CTransaction
::
operator
=
(
const
CTransaction
&
tx
)
{
*
const_cast
<
int
32
_t
*>
(
&
nVersion
)
=
tx
.
nVersion
;
*
const_cast
<
int
16
_t
*>
(
&
nVersion
)
=
tx
.
nVersion
;
*
const_cast
<
int16_t
*>
(
&
nType
)
=
tx
.
nType
;
*
const_cast
<
std
::
vector
<
CTxIn
>*>
(
&
vin
)
=
tx
.
vin
;
*
const_cast
<
std
::
vector
<
CTxOut
>*>
(
&
vout
)
=
tx
.
vout
;
...
...
This diff is collapsed.
Click to expand it.
src/primitives/transaction.h
View file @
763de7c6
...
...
@@ -225,7 +225,12 @@ template<typename Stream, typename TxType>
inline
void
UnserializeTransaction
(
TxType
&
tx
,
Stream
&
s
)
{
const
bool
fAllowWitness
=
!
(
s
.
GetVersion
()
&
SERIALIZE_TRANSACTION_NO_WITNESS
);
s
>>
tx
.
nVersion
;
int32_t
n32bitVersion
=
tx
.
nVersion
|
(
tx
.
nType
<<
16
);
s
>>
n32bitVersion
;
tx
.
nVersion
=
(
int16_t
)(
n32bitVersion
&
0xffff
);
tx
.
nType
=
(
int16_t
)((
n32bitVersion
>>
16
)
&
0xffff
);
unsigned
char
flags
=
0
;
tx
.
vin
.
clear
();
tx
.
vout
.
clear
();
...
...
@@ -264,7 +269,9 @@ template<typename Stream, typename TxType>
inline
void
SerializeTransaction
(
const
TxType
&
tx
,
Stream
&
s
)
{
const
bool
fAllowWitness
=
!
(
s
.
GetVersion
()
&
SERIALIZE_TRANSACTION_NO_WITNESS
);
s
<<
tx
.
nVersion
;
int32_t
n32bitVersion
=
tx
.
nVersion
|
(
tx
.
nType
<<
16
);
s
<<
n32bitVersion
;
unsigned
char
flags
=
0
;
// Consistency check
if
(
fAllowWitness
)
{
...
...
@@ -315,7 +322,7 @@ public:
// structure, including the hash.
const
std
::
vector
<
CTxIn
>
vin
;
const
std
::
vector
<
CTxOut
>
vout
;
const
int
32
_t
nVersion
;
const
int
16
_t
nVersion
;
const
int16_t
nType
;
const
uint32_t
nLockTime
;
const
std
::
vector
<
uint8_t
>
extraPayload
;
// only available for special transaction types
...
...
@@ -345,7 +352,7 @@ public:
/** This deserializing constructor is provided instead of an Unserialize method.
* Unserialize is not possible, since it would require overwriting const fields. */
template
<
typename
Stream
>
CTransaction
(
deserialize_type
,
Stream
&
s
)
:
CTransaction
(
CMutableTransaction
(
deserialize
,
s
))
{}
CTransaction
(
deserialize_type
,
Stream
&
s
)
:
CTransaction
(
CMutableTransaction
(
deserialize
,
s
))
{
ComputeHash
();
}
bool
IsNull
()
const
{
return
vin
.
empty
()
&&
vout
.
empty
();
...
...
@@ -400,7 +407,7 @@ struct CMutableTransaction
{
std
::
vector
<
CTxIn
>
vin
;
std
::
vector
<
CTxOut
>
vout
;
int
32
_t
nVersion
;
int
16
_t
nVersion
;
int16_t
nType
;
uint32_t
nLockTime
;
std
::
vector
<
uint8_t
>
extraPayload
;
// only available for special transaction types
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help