Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
T
tangled
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
eriksson monteiro
tangled
Commits
4d0547f8
Commit
4d0547f8
authored
Jun 06, 2021
by
Eriksson Monteiro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update millix node v1.10.9-tangled
parent
46ec5ad3
Changes
10
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
580 additions
and
513 deletions
+580
-513
millix_node/core/config/config.js
millix_node/core/config/config.js
+2
-2
millix_node/core/config/job.json
millix_node/core/config/job.json
+0
-15
millix_node/core/wallet/wallet-sync.js
millix_node/core/wallet/wallet-sync.js
+22
-9
millix_node/core/wallet/wallet-transaction-consensus.js
millix_node/core/wallet/wallet-transaction-consensus.js
+347
-349
millix_node/core/wallet/wallet-utils.js
millix_node/core/wallet/wallet-utils.js
+12
-7
millix_node/core/wallet/wallet.js
millix_node/core/wallet/wallet.js
+71
-70
millix_node/database/repositories/transaction.js
millix_node/database/repositories/transaction.js
+104
-21
millix_node/index.js
millix_node/index.js
+1
-1
millix_node/net/peer.js
millix_node/net/peer.js
+19
-37
millix_node/scripts/initialize-millix-sqlite3.sql
millix_node/scripts/initialize-millix-sqlite3.sql
+2
-2
No files found.
millix_node/core/config/config.js
View file @
4d0547f8
...
@@ -774,8 +774,8 @@ export const NETWORK_SHORT_TIME_WAIT_MAX = 1500;
...
@@ -774,8 +774,8 @@ export const NETWORK_SHORT_TIME_WAIT_MAX = 1500;
export
const
DATABASE_ENGINE
=
'
sqlite
'
;
export
const
DATABASE_ENGINE
=
'
sqlite
'
;
export
const
DATABASE_CONNECTION
=
{};
export
const
DATABASE_CONNECTION
=
{};
export
const
MILLIX_CIRCULATION
=
9
e15
;
export
const
MILLIX_CIRCULATION
=
9
e15
;
export
const
NODE_MILLIX_BUILD_DATE
=
1622
201109
;
export
const
NODE_MILLIX_BUILD_DATE
=
1622
937315
;
export
const
NODE_MILLIX_VERSION
=
'
1.10.
8
-tangled
'
;
export
const
NODE_MILLIX_VERSION
=
'
1.10.
9
-tangled
'
;
export
const
DATA_BASE_DIR_MAIN_NETWORK
=
'
./millix-tangled
'
;
export
const
DATA_BASE_DIR_MAIN_NETWORK
=
'
./millix-tangled
'
;
export
const
DATA_BASE_DIR_TEST_NETWORK
=
'
./millix-tangled
'
;
export
const
DATA_BASE_DIR_TEST_NETWORK
=
'
./millix-tangled
'
;
let
DATA_BASE_DIR
=
MODE_TEST_NETWORK
?
DATA_BASE_DIR_TEST_NETWORK
:
DATA_BASE_DIR_MAIN_NETWORK
;
let
DATA_BASE_DIR
=
MODE_TEST_NETWORK
?
DATA_BASE_DIR_TEST_NETWORK
:
DATA_BASE_DIR_MAIN_NETWORK
;
...
...
millix_node/core/config/job.json
View file @
4d0547f8
...
@@ -186,21 +186,6 @@
...
@@ -186,21 +186,6 @@
"enable"
:
true
"enable"
:
true
}
}
},
},
"wallet_balance_sync"
:
{
"type"
:
"function"
,
"group"
:
"wallet"
,
"processor"
:
"localhost_wallet"
,
"payload"
:
{
"module"
:
"wallet"
,
"function_name"
:
"_doSyncBalanceForAddresses"
},
"priority"
:
1
,
"option_list"
:
{
"run_always"
:
1
,
"run_delay"
:
10000
,
"enable"
:
true
}
},
"wallet_retry_validation_update"
:
{
"wallet_retry_validation_update"
:
{
"type"
:
"function"
,
"type"
:
"function"
,
"group"
:
"wallet"
,
"group"
:
"wallet"
,
...
...
millix_node/core/wallet/wallet-sync.js
View file @
4d0547f8
...
@@ -119,15 +119,28 @@ export class WalletSync {
...
@@ -119,15 +119,28 @@ export class WalletSync {
}
}
database
.
firstShardZeroORShardRepository
(
'
transaction
'
,
shardID
,
(
transactionRepository
)
=>
{
database
.
firstShardZeroORShardRepository
(
'
transaction
'
,
shardID
,
(
transactionRepository
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
return
transactionRepository
.
getTransactionInput
({
transactionRepository
.
getTransactionInput
({
output_transaction_id
:
transactionID
,
output_transaction_id
:
transactionID
,
output_shard_id
:
shardID
,
output_shard_id
:
shardID
,
output_position
:
outputPosition
output_position
:
outputPosition
})
}).
then
(
input
=>
{
.
then
(
input
=>
input
?
transactionRepository
.
getTransaction
(
input
.
transaction_id
)
:
reject
())
if
(
input
)
{
.
then
(
transaction
=>
resolve
(
transaction
))
/* check if there is any input that is double spend.
.
catch
(()
=>
reject
());
if so, we should force updating this transaction output as spent.
*/
return
transactionRepository
.
listTransactionInput
({
'
transaction_input.transaction_id
'
:
input
.
transaction_id
,
is_double_spend
:
1
}).
then
(
doubleSpendInputList
=>
{
if
(
doubleSpendInputList
.
length
>
0
)
{
return
Promise
.
reject
();
}
return
transactionRepository
.
getTransaction
(
input
.
transaction_id
);
});
}
else
{
return
Promise
.
reject
();
}
});
});
}).
then
(
spendingTransaction
=>
{
}).
then
(
spendingTransaction
=>
{
// skip if we already know that the tx is spent
// skip if we already know that the tx is spent
...
...
millix_node/core/wallet/wallet-transaction-consensus.js
View file @
4d0547f8
This diff is collapsed.
Click to expand it.
millix_node/core/wallet/wallet-utils.js
View file @
4d0547f8
...
@@ -560,7 +560,12 @@ class WalletUtils {
...
@@ -560,7 +560,12 @@ class WalletUtils {
resolve
(
true
);
resolve
(
true
);
}
}
else
{
else
{
this
.
isConsumingExpiredOutputs
(
transaction
.
transaction_input_list
,
transactionDate
)
// before 1620603935 the refresh time was 3 days
// now the refresh time is 10 min (TRANSACTION_OUTPUT_EXPIRE_OLDER_THAN)
const
expireMinutes
=
transactionDate
.
getTime
()
<=
1620603935000
?
4320
:
config
.
TRANSACTION_OUTPUT_EXPIRE_OLDER_THAN
;
let
maximumOldestDate
=
new
Date
(
transactionDate
.
getTime
());
maximumOldestDate
.
setMinutes
(
maximumOldestDate
.
getMinutes
()
-
expireMinutes
);
this
.
isConsumingExpiredOutputs
(
transaction
.
transaction_input_list
,
maximumOldestDate
)
.
then
(
isConsumingExpired
=>
{
.
then
(
isConsumingExpired
=>
{
resolve
(
!
isConsumingExpired
);
resolve
(
!
isConsumingExpired
);
})
})
...
@@ -576,7 +581,7 @@ class WalletUtils {
...
@@ -576,7 +581,7 @@ class WalletUtils {
return
signature
.
verify
(
objectHash
.
getHashBuffer
(
message
),
sign
,
publicKey
);
return
signature
.
verify
(
objectHash
.
getHashBuffer
(
message
),
sign
,
publicKey
);
}
}
isConsumingExpiredOutputs
(
inputList
,
transaction
Date
)
{
isConsumingExpiredOutputs
(
inputList
,
maximumOldest
Date
)
{
return
new
Promise
(
resolve
=>
{
return
new
Promise
(
resolve
=>
{
async
.
eachSeries
(
inputList
,
(
input
,
callback
)
=>
{
async
.
eachSeries
(
inputList
,
(
input
,
callback
)
=>
{
let
output_shard
=
input
.
output_shard_id
;
let
output_shard
=
input
.
output_shard_id
;
...
@@ -589,10 +594,7 @@ class WalletUtils {
...
@@ -589,10 +594,7 @@ class WalletUtils {
callback
(
false
);
callback
(
false
);
}
}
else
{
else
{
let
maximumOldest
=
new
Date
(
transactionDate
.
getTime
());
if
((
maximumOldestDate
-
sourceTransaction
.
transaction_date
)
>
0
)
{
maximumOldest
.
setMinutes
(
maximumOldest
.
getMinutes
()
-
config
.
TRANSACTION_OUTPUT_EXPIRE_OLDER_THAN
);
if
((
maximumOldest
-
sourceTransaction
.
transaction_date
)
>
0
)
{
// Meaning it
// Meaning it
// consumed an
// consumed an
// expired output
// expired output
...
@@ -768,6 +770,9 @@ class WalletUtils {
...
@@ -768,6 +770,9 @@ class WalletUtils {
return
Promise
.
reject
(
'
private key set is required
'
);
return
Promise
.
reject
(
'
private key set is required
'
);
}
}
let
maximumOldestDate
=
new
Date
(
transactionDate
.
getTime
());
maximumOldestDate
.
setMinutes
(
maximumOldestDate
.
getMinutes
()
-
config
.
TRANSACTION_OUTPUT_EXPIRE_OLDER_THAN
);
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
let
allocatedFunds
=
0
;
let
allocatedFunds
=
0
;
const
amount
=
_
.
sum
(
_
.
map
(
outputList
,
o
=>
o
.
amount
))
+
_
.
sum
(
_
.
map
(
feeOutputList
,
o
=>
o
.
amount
));
const
amount
=
_
.
sum
(
_
.
map
(
outputList
,
o
=>
o
.
amount
))
+
_
.
sum
(
_
.
map
(
feeOutputList
,
o
=>
o
.
amount
));
...
@@ -803,7 +808,7 @@ class WalletUtils {
...
@@ -803,7 +808,7 @@ class WalletUtils {
}))
}))
.
then
((
signatureList
)
=>
peer
.
getNodeAddress
()
.
then
((
signatureList
)
=>
peer
.
getNodeAddress
()
.
then
(()
=>
signatureList
))
.
then
(()
=>
signatureList
))
.
then
(
signatureList
=>
this
.
isConsumingExpiredOutputs
(
inputList
,
transaction
Date
).
then
(
isConsumingExpiredOutputs
=>
[
.
then
(
signatureList
=>
this
.
isConsumingExpiredOutputs
(
inputList
,
maximumOldest
Date
).
then
(
isConsumingExpiredOutputs
=>
[
signatureList
,
signatureList
,
isConsumingExpiredOutputs
isConsumingExpiredOutputs
]))
]))
...
...
millix_node/core/wallet/wallet.js
View file @
4d0547f8
This diff is collapsed.
Click to expand it.
millix_node/database/repositories/transaction.js
View file @
4d0547f8
This diff is collapsed.
Click to expand it.
millix_node/index.js
View file @
4d0547f8
...
@@ -109,4 +109,4 @@ db.initialize()
...
@@ -109,4 +109,4 @@ db.initialize()
}
}
})
})
.
then
(()
=>
setTimeout
(()
=>
wallet
.
syncAddresses
(),
2000
));
.
then
(()
=>
setTimeout
(()
=>
wallet
.
syncAddresses
(),
2000
));
//millix v1.10.
8
-tangled
//millix v1.10.
9
-tangled
millix_node/net/peer.js
View file @
4d0547f8
...
@@ -774,18 +774,18 @@ class Peer {
...
@@ -774,18 +774,18 @@ class Peer {
});
});
}
}
addressTransactionSync
(
address
,
updated
,
ws
)
{
walletTransactionSync
(
addressKeyIdentifier
,
excludeTransactionList
,
ws
)
{
if
(
network
.
registeredClients
.
length
===
0
)
{
if
(
network
.
registeredClients
.
length
===
0
)
{
return
address
;
return
;
}
}
console
.
log
(
'
[peer] requesting transaction sync for
address:
'
,
address
,
'
from
'
,
updated
);
console
.
log
(
'
[peer] requesting transaction sync for
wallet:
'
,
addressKeyIdentifier
);
let
payload
=
{
let
payload
=
{
type
:
'
address
_transaction_sync
'
,
type
:
'
wallet
_transaction_sync
'
,
content
:
{
content
:
{
address
,
address
_key_identifier
:
addressKeyIdentifier
,
updated
exclude_transaction_id_list
:
excludeTransactionList
}
}
};
};
...
@@ -800,18 +800,6 @@ class Peer {
...
@@ -800,18 +800,6 @@ class Peer {
console
.
log
(
'
[WARN]: try to send data over a closed connection.
'
);
console
.
log
(
'
[WARN]: try to send data over a closed connection.
'
);
}
}
}
}
else
{
network
.
registeredClients
.
forEach
(
ws
=>
{
try
{
ws
.
nodeConnectionReady
&&
!
(
ws
.
inBound
&&
!
ws
.
bidirectional
)
&&
ws
.
send
(
data
);
}
catch
(
e
)
{
console
.
log
(
'
[WARN]: try to send data over a closed connection.
'
);
}
});
}
return
address
;
}
}
transactionSyncResponse
(
content
,
ws
)
{
transactionSyncResponse
(
content
,
ws
)
{
...
@@ -954,11 +942,6 @@ class Peer {
...
@@ -954,11 +942,6 @@ class Peer {
return
;
return
;
}
}
return
walletSync
.
getTransactionUnresolvedData
(
transactionID
)
.
then
(
unresolvedTransaction
=>
{
if
(
unresolvedTransaction
)
{
return
;
}
let
payload
=
{
let
payload
=
{
type
:
'
transaction_sync_by_date_response:
'
+
network
.
nodeID
,
type
:
'
transaction_sync_by_date_response:
'
+
network
.
nodeID
,
content
:
{
transaction_id_list
:
transactionList
}
content
:
{
transaction_id_list
:
transactionList
}
...
@@ -973,7 +956,6 @@ class Peer {
...
@@ -973,7 +956,6 @@ class Peer {
catch
(
e
)
{
catch
(
e
)
{
console
.
log
(
'
[WARN]: try to send data over a closed connection.
'
);
console
.
log
(
'
[WARN]: try to send data over a closed connection.
'
);
}
}
});
}
}
transactionSyncByDate
(
beginTimestamp
,
endTimestamp
,
excludeTransactionList
,
ws
)
{
transactionSyncByDate
(
beginTimestamp
,
endTimestamp
,
excludeTransactionList
,
ws
)
{
...
@@ -982,7 +964,7 @@ class Peer {
...
@@ -982,7 +964,7 @@ class Peer {
let
start
=
Date
.
now
();
let
start
=
Date
.
now
();
let
nodeID
=
ws
.
nodeID
;
let
nodeID
=
ws
.
nodeID
;
console
.
log
(
`[peer] requesting transaction sync by date from
${
new
Date
(
beginTimestamp
)}
to
${
new
Date
(
endTimestamp
)}
: node
${
nodeID
}
`
);
console
.
log
(
`[peer] requesting transaction sync by date from
${
new
Date
(
beginTimestamp
*
1000
)}
to
${
new
Date
(
endTimestamp
*
1000
)}
: node
${
nodeID
}
`
);
let
payload
=
{
let
payload
=
{
type
:
'
transaction_sync_by_date
'
,
type
:
'
transaction_sync_by_date
'
,
content
:
{
content
:
{
...
...
millix_node/scripts/initialize-millix-sqlite3.sql
View file @
4d0547f8
...
@@ -96,7 +96,7 @@ CREATE TABLE `transaction`
...
@@ -96,7 +96,7 @@ CREATE TABLE `transaction`
is_parent
TINYINT
NOT
NULL
DEFAULT
0
CHECK
(
is_parent
=
0
OR
is_parent
=
1
),
is_parent
TINYINT
NOT
NULL
DEFAULT
0
CHECK
(
is_parent
=
0
OR
is_parent
=
1
),
timeout_date
INT
NULL
CHECK
(
length
(
timeout_date
)
<=
10
AND
TYPEOF
(
timeout_date
)
IN
(
'integer'
,
'null'
)),
timeout_date
INT
NULL
CHECK
(
length
(
timeout_date
)
<=
10
AND
TYPEOF
(
timeout_date
)
IN
(
'integer'
,
'null'
)),
is_timeout
TINYINT
NOT
NULL
DEFAULT
0
CHECK
(
is_timeout
=
0
OR
is_timeout
=
1
),
is_timeout
TINYINT
NOT
NULL
DEFAULT
0
CHECK
(
is_timeout
=
0
OR
is_timeout
=
1
),
status
TINYINT
NOT
NULL
DEFAULT
1
CHECK
(
length
(
status
)
<=
3
AND
TYPEOF
(
status
)
=
'integer'
),
status
TINYINT
NOT
NULL
DEFAULT
1
CHECK
(
length
(
status
)
<=
3
AND
TYPEOF
(
status
)
=
'integer'
),
/*1: default, 2: prune, 3: invalid*/
create_date
INT
NOT
NULL
DEFAULT
(
CAST
(
strftime
(
'%s'
,
'now'
)
AS
INTEGER
))
CHECK
(
length
(
create_date
)
<=
10
AND
TYPEOF
(
create_date
)
=
'integer'
)
create_date
INT
NOT
NULL
DEFAULT
(
CAST
(
strftime
(
'%s'
,
'now'
)
AS
INTEGER
))
CHECK
(
length
(
create_date
)
<=
10
AND
TYPEOF
(
create_date
)
=
'integer'
)
);
);
CREATE
INDEX
idx_transaction_status_is_stable_transaction_date
ON
`transaction`
(
status
,
is_stable
,
transaction_date
);
CREATE
INDEX
idx_transaction_status_is_stable_transaction_date
ON
`transaction`
(
status
,
is_stable
,
transaction_date
);
...
@@ -174,7 +174,7 @@ CREATE TABLE transaction_output
...
@@ -174,7 +174,7 @@ CREATE TABLE transaction_output
is_spent
TINYINT
NOT
NULL
DEFAULT
0
CHECK
(
is_spent
=
0
OR
is_spent
=
1
),
is_spent
TINYINT
NOT
NULL
DEFAULT
0
CHECK
(
is_spent
=
0
OR
is_spent
=
1
),
double_spend_date
INT
NULL
CHECK
(
length
(
double_spend_date
)
<=
10
AND
TYPEOF
(
double_spend_date
)
IN
(
'integer'
,
'null'
)),
-- NOT NULL if double spend
double_spend_date
INT
NULL
CHECK
(
length
(
double_spend_date
)
<=
10
AND
TYPEOF
(
double_spend_date
)
IN
(
'integer'
,
'null'
)),
-- NOT NULL if double spend
is_double_spend
TINYINT
NOT
NULL
DEFAULT
0
CHECK
(
is_double_spend
=
0
OR
is_double_spend
=
1
),
is_double_spend
TINYINT
NOT
NULL
DEFAULT
0
CHECK
(
is_double_spend
=
0
OR
is_double_spend
=
1
),
status
TINYINT
NOT
NULL
DEFAULT
1
CHECK
(
length
(
status
)
<=
3
AND
TYPEOF
(
status
)
=
'integer'
),
status
TINYINT
NOT
NULL
DEFAULT
1
CHECK
(
length
(
status
)
<=
3
AND
TYPEOF
(
status
)
=
'integer'
),
/*1: default, 2: expired*/
create_date
INT
NOT
NULL
DEFAULT
(
CAST
(
strftime
(
'%s'
,
'now'
)
AS
INTEGER
))
CHECK
(
length
(
create_date
)
<=
10
AND
TYPEOF
(
create_date
)
=
'integer'
),
create_date
INT
NOT
NULL
DEFAULT
(
CAST
(
strftime
(
'%s'
,
'now'
)
AS
INTEGER
))
CHECK
(
length
(
create_date
)
<=
10
AND
TYPEOF
(
create_date
)
=
'integer'
),
PRIMARY
KEY
(
transaction_id
,
output_position
),
PRIMARY
KEY
(
transaction_id
,
output_position
),
FOREIGN
KEY
(
transaction_id
)
REFERENCES
`transaction`
(
transaction_id
),
FOREIGN
KEY
(
transaction_id
)
REFERENCES
`transaction`
(
transaction_id
),
...
...
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