Skip to content

Commit

Permalink
local node
Browse files Browse the repository at this point in the history
  • Loading branch information
nginnever committed Jul 16, 2018
1 parent 5dcb918 commit 199b3f7
Show file tree
Hide file tree
Showing 6 changed files with 1,013 additions and 1,009 deletions.
5 changes: 2 additions & 3 deletions test/helpers/utils.js
@@ -1,7 +1,7 @@
const Buffer = require('buffer').Buffer
const util = require('ethereumjs-util')
const Web3latest = require('web3')
const web3latest = new Web3latest(new Web3latest.providers.HttpProvider("http://localhost:7545"))
const web3latest = new Web3latest(new Web3latest.providers.HttpProvider("http://localhost:8545"))

module.exports = {
latestTime: async function latestTime() {
Expand All @@ -11,7 +11,6 @@ module.exports = {

increaseTime: function increaseTime(duration) {
const id = Date.now()

return new Promise((resolve, reject) => {
web3latest.currentProvider.send({
jsonrpc: '2.0',
Expand Down Expand Up @@ -73,7 +72,7 @@ module.exports = {
},

duration: {
seconds: function(val) { return val},
seconds: function(val) { return val * 1000},
minutes: function(val) { return val * this.seconds(60) },
hours: function(val) { return val * this.minutes(60) },
days: function(val) { return val * this.hours(24) },
Expand Down
6 changes: 3 additions & 3 deletions test/scenarios/AliceDisputeVCTest.js
Expand Up @@ -6,7 +6,7 @@ const Ledger = artifacts.require('./LedgerChannel.sol')
const EC = artifacts.require('./ECTools.sol')

const Web3latest = require('web3')
const web3latest = new Web3latest(new Web3latest.providers.HttpProvider("http://localhost:7545")) //ganache port
const web3latest = new Web3latest(new Web3latest.providers.HttpProvider("http://localhost:8545")) //ganache port

let lc

Expand Down Expand Up @@ -92,14 +92,14 @@ contract('Test Alice Disputed VC Payments', function(accounts) {


it("Alice initiates ledger channel with lcS0", async () => {
let res = await lc.createChannel(web3latest.utils.sha3('0000', {encoding: 'hex'}), partyI, Utils.duration.seconds(1), {from:partyA, value: web3latest.utils.toWei('10')})
let res = await lc.createChannel(web3latest.utils.sha3('0000', {encoding: 'hex'}), partyI, Utils.duration.seconds(10), {from:partyA, value: web3latest.utils.toWei('10')})
time = res.logs[0].args.time

})

it("Alice can exit openChannel before hub joins", async () => {
await Utils.expectThrow(lc.LCOpenTimeout(web3latest.utils.sha3('0000', {encoding: 'hex'})))
//await Utils.increaseTime(time.plus(Utils.duration.seconds(1)))
await Utils.increaseTime(Utils.duration.seconds(10))
await lc.LCOpenTimeout(web3latest.utils.sha3('0000', {encoding: 'hex'}))
})

Expand Down

0 comments on commit 199b3f7

Please sign in to comment.