Skip to content

Commit

Permalink
Ms.transaction fixes (Chia-Network#227)
Browse files Browse the repository at this point in the history
* dbus alternative for linux

* key migration

* reset mnemonics

* Fix tests, and start working on key selection

* Implement UI for changing keys

* Removing keys and mnemonic button

* Start making farmer and harvester RPCs

* routing, daemon, react
* Fix rpc shutdown

* Harvester and farmer websocket, and basic UI
* Plot display and deletion
* use proper config:
* don't crash on nondefined
* local test false
* launch daemon on start
* farmer clean
* get blocks
* header table
* Start with farmer callback, fix bug in getting latest blocks
* State changes from full node, harvester, farmer, and full node ui improvements
* split balances in react
* pending change balance
* plotter
* dev config
* gitignore fail..
* maintain connection / retry
* Fix tests
* Remove electron-ui, and style fixes
* Better farmer and full node control
* Remove electron ui references
* Uncomment out starting the dameon
* Add to changelog
* Remove timelord tab, and change full node style
* Clean up new wallet login
* Refactor RPCs
* Fix flake8 import issues in full_node_rpc_server.py
* add balance split to coloured coin wallet
* spendable balance fix
* Import private key from UI fix
* Various fixes to transaction sending, and UI tweaks
* Fix merge issues

Co-authored-by: Yostra <[email protected]>
Co-authored-by: Lipa Long <[email protected]>
Co-authored-by: Gene Hoffman <[email protected]>
  • Loading branch information
4 people authored and wjblanke committed Jun 1, 2020
1 parent 75e442d commit c73300b
Show file tree
Hide file tree
Showing 20 changed files with 480 additions and 279 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,5 @@ vdf_bench
electron-react/src/dev_config.js
# React built app
electron-react/build
build_scripts/dist
build_scripts/*.Dmg
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ and this project does not yet adhere to [Semantic Versioning](https://semver.org
- Moved to PyYAML 5.3.1 which prevents arbitrary code execution during python/object/new constructor.
- Moved to Python cryptography 2.9.2 which deprecates OpenSSL 1.0.1 and now relies upon OpenSSL 1.1.1g.
- Moved to aiosqlite 0.13.0 which adds official support for Python 3.8 and fixes a possible hung thread if a connection failed.
- Replaced JS interface with React user interface which is cleaner and more responsive

### Fixed

Expand Down
2 changes: 1 addition & 1 deletion electron-react/src/dev_config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const dev_config = {
redux_tool: null,
react_tool: null,
react_tool: null
//react_tool: "/Library/Application Support/Google/Chrome/Default/Extensions/fmkadmapgofadopljbjfkapdkoienihi/4.6.0_0",
//redux_tool: "/Library/Application Support/Google/Chrome/Default/Extensions/lmhkpmbekcpmknklioeibfkpmmfibljd/2.17.0_0"
};
Expand Down
8 changes: 4 additions & 4 deletions electron-react/src/middleware/middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,15 @@ const socketMiddleware = () => {
case "OUTGOING_MESSAGE":
if (connected) {
const message = outgoing_message(
action.command,
action.data,
action.destination
action.message.command,
action.message.data,
action.message.destination
);
socket.send(JSON.stringify(message));
} else {
console.log("Socket not connected");
}
break;
return next(action);
default:
return next(action);
}
Expand Down
20 changes: 11 additions & 9 deletions electron-react/src/modules/daemon_messages.js
Original file line number Diff line number Diff line change
@@ -1,32 +1,34 @@
export const daemonMessage = () => ({
type: "OUTGOING_MESSAGE",
destination: "daemon"
message: {
destination: "daemon"
}
});

export const registerService = () => {
var action = daemonMessage();
action.command = "register_service";
action.data = { service: "wallet_ui" };
action.message.command = "register_service";
action.message.data = { service: "wallet_ui" };
return action;
};

export const startService = service_name => {
var action = daemonMessage();
action.command = "start_service";
action.data = { service: service_name };
action.message.command = "start_service";
action.message.data = { service: service_name };
return action;
};

export const stopService = service_name => {
var action = daemonMessage();
action.command = "stop_service";
action.data = { service: service_name };
action.message.command = "stop_service";
action.message.data = { service: service_name };
return action;
};

export const isServiceRunning = service_name => {
var action = daemonMessage();
action.command = "is_running";
action.data = { service: service_name };
action.message.command = "is_running";
action.message.data = { service: service_name };
return action;
};
24 changes: 13 additions & 11 deletions electron-react/src/modules/farmerMessages.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,42 @@ import { service_farmer } from "../util/service_names";

export const farmerMessage = () => ({
type: "OUTGOING_MESSAGE",
destination: service_farmer
message: {
destination: service_farmer
}
});

export const pingFarmer = () => {
var action = farmerMessage();
action.command = "ping";
action.data = {};
action.message.command = "ping";
action.message.data = {};
return action;
};

export const getLatestChallenges = () => {
var action = farmerMessage();
action.command = "get_latest_challenges";
action.data = {};
action.message.command = "get_latest_challenges";
action.message.data = {};
return action;
};

export const getFarmerConnections = () => {
var action = farmerMessage();
action.command = "get_connections";
action.data = {};
action.message.command = "get_connections";
action.message.data = {};
return action;
};

export const openConnection = (host, port) => {
var action = farmerMessage();
action.command = "open_connection";
action.data = { host, port };
action.message.command = "open_connection";
action.message.data = { host, port };
return action;
};

export const closeConnection = node_id => {
var action = farmerMessage();
action.command = "close_connection";
action.data = { node_id };
action.message.command = "close_connection";
action.message.data = { node_id };
return action;
};
4 changes: 3 additions & 1 deletion electron-react/src/modules/farming_api.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ const initial_state = {
open_connection_error: ""
},
harvester: {
plots: []
plots: [],
not_found_filenames: [],
failed_to_open_filenames: []
}
};

Expand Down
36 changes: 19 additions & 17 deletions electron-react/src/modules/fullnodeMessages.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,62 +2,64 @@ import { service_full_node } from "../util/service_names";

export const fullNodeMessage = () => ({
type: "OUTGOING_MESSAGE",
destination: service_full_node
message: {
destination: service_full_node
}
});

export const pingFullNode = () => {
var action = fullNodeMessage();
action.command = "ping";
action.data = {};
action.message.command = "ping";
action.message.data = {};
return action;
};

export const getBlockChainState = () => {
var action = fullNodeMessage();
action.command = "get_blockchain_state";
action.data = {};
action.message.command = "get_blockchain_state";
action.message.data = {};
return action;
};

export const getLatestBlocks = () => {
var action = fullNodeMessage();
action.command = "get_latest_block_headers";
action.data = {};
action.message.command = "get_latest_block_headers";
action.message.data = {};
return action;
};

export const getFullNodeConnections = () => {
var action = fullNodeMessage();
action.command = "get_connections";
action.data = {};
action.message.command = "get_connections";
action.message.data = {};
return action;
};

export const openConnection = (host, port) => {
var action = fullNodeMessage();
action.command = "open_connection";
action.data = { host, port };
action.message.command = "open_connection";
action.message.data = { host, port };
return action;
};

export const closeConnection = node_id => {
var action = fullNodeMessage();
action.command = "close_connection";
action.data = { node_id };
action.message.command = "close_connection";
action.message.data = { node_id };
return action;
};

export const getBlock = header_hash => {
var action = fullNodeMessage();
action.command = "get_block";
action.data = { header_hash };
action.message.command = "get_block";
action.message.data = { header_hash };
return action;
};

export const getHeader = header_hash => {
var action = fullNodeMessage();
action.command = "get_header";
action.data = { header_hash };
action.message.command = "get_header";
action.message.data = { header_hash };
return action;
};

Expand Down
20 changes: 11 additions & 9 deletions electron-react/src/modules/harvesterMessages.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,35 @@ import { service_harvester } from "../util/service_names";

export const harvesterMessage = () => ({
type: "OUTGOING_MESSAGE",
destination: service_harvester
message: {
destination: service_harvester
}
});

export const pingHarvester = () => {
var action = harvesterMessage();
action.command = "ping";
action.data = {};
action.message.command = "ping";
action.message.data = {};
return action;
};

export const getPlots = () => {
var action = harvesterMessage();
action.command = "get_plots";
action.data = {};
action.message.command = "get_plots";
action.message.data = {};
return action;
};

export const deletePlot = filename => {
var action = harvesterMessage();
action.command = "delete_plot";
action.data = { filename };
action.message.command = "delete_plot";
action.message.data = { filename };
return action;
};

export const refreshPlots = () => {
var action = harvesterMessage();
action.command = "refresh_plots";
action.data = {};
action.message.command = "refresh_plots";
action.message.data = {};
return action;
};
27 changes: 24 additions & 3 deletions electron-react/src/modules/incoming_api.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,30 @@ const initial_state = {
connections: [],
connection_count: 0,
syncing: false
}
},
sending_transaction: false,
send_transaction_result: null
};

export const incomingReducer = (state = { ...initial_state }, action) => {
switch (action.type) {
case "LOG_OUT":
return { ...state, logged_in: false };

case "CLEAR_SEND":
state["sending_transaction"] = false;
state["send_transaction_result"] = null;
return state;

case "OUTGOING_MESSAGE":
if (
action.message.command === "send_transaction" ||
action.message.command === "cc_spend"
) {
state["sending_transaction"] = true;
state["send_transaction_result"] = null;
}
return state;
case "INCOMING_MESSAGE":
if (action.message.origin !== service_wallet_server) {
return state;
Expand Down Expand Up @@ -121,11 +138,10 @@ export const incomingReducer = (state = { ...initial_state }, action) => {
wallets = state.wallets;
wallet = wallets[parseInt(id)];
var balance = data.confirmed_wallet_balance;
console.log("balance is: " + balance);
var unconfirmed_balance = data.unconfirmed_wallet_balance;
var frozen_balance = data.frozen_balance;
var spendable_balance = data.spendable_balance;
var change_balance = data.change_balance;
var change_balance = data.pending_change;
wallet.balance_total = balance;
wallet.balance_pending = unconfirmed_balance;
wallet.balance_frozen = frozen_balance;
Expand Down Expand Up @@ -183,6 +199,11 @@ export const incomingReducer = (state = { ...initial_state }, action) => {
wallet.name = name;
return state;
}
if (command === "send_transaction" || command === "cc_spend") {
state["sending_transaction"] = false;
state["send_transaction_result"] = message.data;
return state;
}
return state;
default:
return state;
Expand Down
Loading

0 comments on commit c73300b

Please sign in to comment.