Skip to content
This repository has been archived by the owner on Jun 10, 2019. It is now read-only.

Sign transaction receipt, fix #46 #48

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 9 additions & 1 deletion src/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ const models = require('plasma-utils').serialization.models
const SignedTransaction = models.SignedTransaction
const debug = require('debug')

debug.enable('info:state,info:block-store,info:leveldb-sum-tree')
if (process.env.DEBUG === undefined) {
// If no logging is enabled, set these as defaults
debug.enable('info:state,info:block-store,info:leveldb-sum-tree')
}

// Set up express
const app = express()
Expand Down Expand Up @@ -74,6 +77,11 @@ app.post('/api', function (req, res) {
}
sendMessage(stateManager, req.body).then((response) => {
log('OUTGOING response to RPC request with method:', req.body.method, 'and rpcID:', req.body.id)
if (req.body.method === constants.ADD_TX_METHOD) {
// Have Operator sign transaction
const tx = new SignedTransaction(req.body.params[0])
response.message.signature = EthService.web3.eth.accounts.sign(tx.hash, EthService.web3.eth.accounts.wallet[0].privateKey)
}
res.send(response.message)
})
} else if (req.body.method === constants.GET_HISTORY_PROOF ||
Expand Down