@@ -21,11 +21,9 @@ TransactionData.prototype.read = function(txHash) {
21
21
22
22
TransactionData . prototype . create = function ( entity ) {
23
23
return pool . query ( "SELECT nextval(pg_get_serial_sequence('transactiondata', 'txid')) as txId;" ) . then ( function ( result ) {
24
- // calculate txHash
25
24
var txId = result . rows [ 0 ] . txid ;
26
- console . log ( 'txId: ' + txId ) ;
27
25
var txHash = keccak_256 ( txId ) ;
28
- // console.log('txId: ' + txId + ', txHash: ' + txHash);
26
+ console . log ( 'txId: ' + txId + ', txHash: ' + txHash ) ;
29
27
return pool . query ( "INSERT INTO transactiondata (txid, txhash, data, status, network, txtimestamp) " +
30
28
"values ($1, $2, $3, $4, $5, $6)" ,
31
29
[ txId , txHash , entity . data , 'UNAPPROVED' , 'testnet' , 'now' ] ) . then ( function ( ) {
@@ -39,6 +37,7 @@ TransactionData.prototype.create = function(entity) {
39
37
} ;
40
38
41
39
TransactionData . prototype . update = function ( entity ) {
40
+ // TODO 定義 status
42
41
return pool . query ( "UPDATE transactiondata SET " +
43
42
"transactionhash = $1, datahash = $2, status = $3, blocknumber = $4, blockhash = $5, fromAddress = $6 WHERE txhash = $7" ,
44
43
[ entity . transactionHash , entity . dataHash , entity . status , entity . blockNumber , entity . blockHash , entity . fromAddress , entity . txHash ] ) ;
0 commit comments