2017-10-09 20:19:26 +03:00
|
|
|
// Copyright 2017 The Grin Developers
|
2017-09-24 07:40:31 +03:00
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
|
|
|
|
use checker;
|
2017-10-06 23:10:30 +03:00
|
|
|
use keychain::Keychain;
|
2017-09-24 07:40:31 +03:00
|
|
|
use types::{WalletConfig, WalletData};
|
|
|
|
|
2017-10-12 19:56:44 +03:00
|
|
|
pub fn show_info(config: &WalletConfig, keychain: &Keychain) {
|
2017-10-13 07:45:07 +03:00
|
|
|
let root_key_id = keychain.root_key_id();
|
2017-10-03 03:02:31 +03:00
|
|
|
let _ = checker::refresh_outputs(&config, &keychain);
|
2017-09-24 07:40:31 +03:00
|
|
|
|
|
|
|
// operate within a lock on wallet data
|
|
|
|
let _ = WalletData::with_wallet(&config.data_file_dir, |wallet_data| {
|
|
|
|
|
|
|
|
println!("Outputs - ");
|
2017-10-13 07:45:07 +03:00
|
|
|
println!("key_id, height, lock_height, status, value");
|
2017-09-24 07:40:31 +03:00
|
|
|
println!("----------------------------------");
|
|
|
|
|
2017-10-12 19:56:44 +03:00
|
|
|
let mut outputs = wallet_data
|
|
|
|
.outputs
|
2017-10-06 23:10:30 +03:00
|
|
|
.values()
|
2017-10-13 07:45:07 +03:00
|
|
|
.filter(|out| out.root_key_id == root_key_id)
|
2017-10-06 23:10:30 +03:00
|
|
|
.collect::<Vec<_>>();
|
|
|
|
outputs.sort_by_key(|out| out.n_child);
|
|
|
|
for out in outputs {
|
2017-09-24 07:40:31 +03:00
|
|
|
println!(
|
2017-10-13 07:45:07 +03:00
|
|
|
"{}, {}, {}, {:?}, {}",
|
|
|
|
out.key_id,
|
2017-09-24 07:40:31 +03:00
|
|
|
out.height,
|
|
|
|
out.lock_height,
|
|
|
|
out.status,
|
|
|
|
out.value
|
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|