You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

499 lines
12 KiB

cleanup: Reduce and normalize import path aliasing. (#6975) The code in the Tendermint repository makes heavy use of import aliasing. This is made necessary by our extensive reuse of common base package names, and by repetition of similar names across different subdirectories. Unfortunately we have not been very consistent about which packages we alias in various circumstances, and the aliases we use vary. In the spirit of the advice in the style guide and https://github.com/golang/go/wiki/CodeReviewComments#imports, his change makes an effort to clean up and normalize import aliasing. This change makes no API or behavioral changes. It is a pure cleanup intended o help make the code more readable to developers (including myself) trying to understand what is being imported where. Only unexported names have been modified, and the changes were generated and applied mechanically with gofmt -r and comby, respecting the lexical and syntactic rules of Go. Even so, I did not fix every inconsistency. Where the changes would be too disruptive, I left it alone. The principles I followed in this cleanup are: - Remove aliases that restate the package name. - Remove aliases where the base package name is unambiguous. - Move overly-terse abbreviations from the import to the usage site. - Fix lexical issues (remove underscores, remove capitalization). - Fix import groupings to more closely match the style guide. - Group blank (side-effecting) imports and ensure they are commented. - Add aliases to multiple imports with the same base package name.
3 years ago
cleanup: Reduce and normalize import path aliasing. (#6975) The code in the Tendermint repository makes heavy use of import aliasing. This is made necessary by our extensive reuse of common base package names, and by repetition of similar names across different subdirectories. Unfortunately we have not been very consistent about which packages we alias in various circumstances, and the aliases we use vary. In the spirit of the advice in the style guide and https://github.com/golang/go/wiki/CodeReviewComments#imports, his change makes an effort to clean up and normalize import aliasing. This change makes no API or behavioral changes. It is a pure cleanup intended o help make the code more readable to developers (including myself) trying to understand what is being imported where. Only unexported names have been modified, and the changes were generated and applied mechanically with gofmt -r and comby, respecting the lexical and syntactic rules of Go. Even so, I did not fix every inconsistency. Where the changes would be too disruptive, I left it alone. The principles I followed in this cleanup are: - Remove aliases that restate the package name. - Remove aliases where the base package name is unambiguous. - Move overly-terse abbreviations from the import to the usage site. - Fix lexical issues (remove underscores, remove capitalization). - Fix import groupings to more closely match the style guide. - Group blank (side-effecting) imports and ensure they are commented. - Add aliases to multiple imports with the same base package name.
3 years ago
cleanup: Reduce and normalize import path aliasing. (#6975) The code in the Tendermint repository makes heavy use of import aliasing. This is made necessary by our extensive reuse of common base package names, and by repetition of similar names across different subdirectories. Unfortunately we have not been very consistent about which packages we alias in various circumstances, and the aliases we use vary. In the spirit of the advice in the style guide and https://github.com/golang/go/wiki/CodeReviewComments#imports, his change makes an effort to clean up and normalize import aliasing. This change makes no API or behavioral changes. It is a pure cleanup intended o help make the code more readable to developers (including myself) trying to understand what is being imported where. Only unexported names have been modified, and the changes were generated and applied mechanically with gofmt -r and comby, respecting the lexical and syntactic rules of Go. Even so, I did not fix every inconsistency. Where the changes would be too disruptive, I left it alone. The principles I followed in this cleanup are: - Remove aliases that restate the package name. - Remove aliases where the base package name is unambiguous. - Move overly-terse abbreviations from the import to the usage site. - Fix lexical issues (remove underscores, remove capitalization). - Fix import groupings to more closely match the style guide. - Group blank (side-effecting) imports and ensure they are commented. - Add aliases to multiple imports with the same base package name.
3 years ago
cleanup: Reduce and normalize import path aliasing. (#6975) The code in the Tendermint repository makes heavy use of import aliasing. This is made necessary by our extensive reuse of common base package names, and by repetition of similar names across different subdirectories. Unfortunately we have not been very consistent about which packages we alias in various circumstances, and the aliases we use vary. In the spirit of the advice in the style guide and https://github.com/golang/go/wiki/CodeReviewComments#imports, his change makes an effort to clean up and normalize import aliasing. This change makes no API or behavioral changes. It is a pure cleanup intended o help make the code more readable to developers (including myself) trying to understand what is being imported where. Only unexported names have been modified, and the changes were generated and applied mechanically with gofmt -r and comby, respecting the lexical and syntactic rules of Go. Even so, I did not fix every inconsistency. Where the changes would be too disruptive, I left it alone. The principles I followed in this cleanup are: - Remove aliases that restate the package name. - Remove aliases where the base package name is unambiguous. - Move overly-terse abbreviations from the import to the usage site. - Fix lexical issues (remove underscores, remove capitalization). - Fix import groupings to more closely match the style guide. - Group blank (side-effecting) imports and ensure they are commented. - Add aliases to multiple imports with the same base package name.
3 years ago
cleanup: Reduce and normalize import path aliasing. (#6975) The code in the Tendermint repository makes heavy use of import aliasing. This is made necessary by our extensive reuse of common base package names, and by repetition of similar names across different subdirectories. Unfortunately we have not been very consistent about which packages we alias in various circumstances, and the aliases we use vary. In the spirit of the advice in the style guide and https://github.com/golang/go/wiki/CodeReviewComments#imports, his change makes an effort to clean up and normalize import aliasing. This change makes no API or behavioral changes. It is a pure cleanup intended o help make the code more readable to developers (including myself) trying to understand what is being imported where. Only unexported names have been modified, and the changes were generated and applied mechanically with gofmt -r and comby, respecting the lexical and syntactic rules of Go. Even so, I did not fix every inconsistency. Where the changes would be too disruptive, I left it alone. The principles I followed in this cleanup are: - Remove aliases that restate the package name. - Remove aliases where the base package name is unambiguous. - Move overly-terse abbreviations from the import to the usage site. - Fix lexical issues (remove underscores, remove capitalization). - Fix import groupings to more closely match the style guide. - Group blank (side-effecting) imports and ensure they are commented. - Add aliases to multiple imports with the same base package name.
3 years ago
cleanup: Reduce and normalize import path aliasing. (#6975) The code in the Tendermint repository makes heavy use of import aliasing. This is made necessary by our extensive reuse of common base package names, and by repetition of similar names across different subdirectories. Unfortunately we have not been very consistent about which packages we alias in various circumstances, and the aliases we use vary. In the spirit of the advice in the style guide and https://github.com/golang/go/wiki/CodeReviewComments#imports, his change makes an effort to clean up and normalize import aliasing. This change makes no API or behavioral changes. It is a pure cleanup intended o help make the code more readable to developers (including myself) trying to understand what is being imported where. Only unexported names have been modified, and the changes were generated and applied mechanically with gofmt -r and comby, respecting the lexical and syntactic rules of Go. Even so, I did not fix every inconsistency. Where the changes would be too disruptive, I left it alone. The principles I followed in this cleanup are: - Remove aliases that restate the package name. - Remove aliases where the base package name is unambiguous. - Move overly-terse abbreviations from the import to the usage site. - Fix lexical issues (remove underscores, remove capitalization). - Fix import groupings to more closely match the style guide. - Group blank (side-effecting) imports and ensure they are commented. - Add aliases to multiple imports with the same base package name.
3 years ago
cleanup: Reduce and normalize import path aliasing. (#6975) The code in the Tendermint repository makes heavy use of import aliasing. This is made necessary by our extensive reuse of common base package names, and by repetition of similar names across different subdirectories. Unfortunately we have not been very consistent about which packages we alias in various circumstances, and the aliases we use vary. In the spirit of the advice in the style guide and https://github.com/golang/go/wiki/CodeReviewComments#imports, his change makes an effort to clean up and normalize import aliasing. This change makes no API or behavioral changes. It is a pure cleanup intended o help make the code more readable to developers (including myself) trying to understand what is being imported where. Only unexported names have been modified, and the changes were generated and applied mechanically with gofmt -r and comby, respecting the lexical and syntactic rules of Go. Even so, I did not fix every inconsistency. Where the changes would be too disruptive, I left it alone. The principles I followed in this cleanup are: - Remove aliases that restate the package name. - Remove aliases where the base package name is unambiguous. - Move overly-terse abbreviations from the import to the usage site. - Fix lexical issues (remove underscores, remove capitalization). - Fix import groupings to more closely match the style guide. - Group blank (side-effecting) imports and ensure they are commented. - Add aliases to multiple imports with the same base package name.
3 years ago
cleanup: Reduce and normalize import path aliasing. (#6975) The code in the Tendermint repository makes heavy use of import aliasing. This is made necessary by our extensive reuse of common base package names, and by repetition of similar names across different subdirectories. Unfortunately we have not been very consistent about which packages we alias in various circumstances, and the aliases we use vary. In the spirit of the advice in the style guide and https://github.com/golang/go/wiki/CodeReviewComments#imports, his change makes an effort to clean up and normalize import aliasing. This change makes no API or behavioral changes. It is a pure cleanup intended o help make the code more readable to developers (including myself) trying to understand what is being imported where. Only unexported names have been modified, and the changes were generated and applied mechanically with gofmt -r and comby, respecting the lexical and syntactic rules of Go. Even so, I did not fix every inconsistency. Where the changes would be too disruptive, I left it alone. The principles I followed in this cleanup are: - Remove aliases that restate the package name. - Remove aliases where the base package name is unambiguous. - Move overly-terse abbreviations from the import to the usage site. - Fix lexical issues (remove underscores, remove capitalization). - Fix import groupings to more closely match the style guide. - Group blank (side-effecting) imports and ensure they are commented. - Add aliases to multiple imports with the same base package name.
3 years ago
cleanup: Reduce and normalize import path aliasing. (#6975) The code in the Tendermint repository makes heavy use of import aliasing. This is made necessary by our extensive reuse of common base package names, and by repetition of similar names across different subdirectories. Unfortunately we have not been very consistent about which packages we alias in various circumstances, and the aliases we use vary. In the spirit of the advice in the style guide and https://github.com/golang/go/wiki/CodeReviewComments#imports, his change makes an effort to clean up and normalize import aliasing. This change makes no API or behavioral changes. It is a pure cleanup intended o help make the code more readable to developers (including myself) trying to understand what is being imported where. Only unexported names have been modified, and the changes were generated and applied mechanically with gofmt -r and comby, respecting the lexical and syntactic rules of Go. Even so, I did not fix every inconsistency. Where the changes would be too disruptive, I left it alone. The principles I followed in this cleanup are: - Remove aliases that restate the package name. - Remove aliases where the base package name is unambiguous. - Move overly-terse abbreviations from the import to the usage site. - Fix lexical issues (remove underscores, remove capitalization). - Fix import groupings to more closely match the style guide. - Group blank (side-effecting) imports and ensure they are commented. - Add aliases to multiple imports with the same base package name.
3 years ago
cleanup: Reduce and normalize import path aliasing. (#6975) The code in the Tendermint repository makes heavy use of import aliasing. This is made necessary by our extensive reuse of common base package names, and by repetition of similar names across different subdirectories. Unfortunately we have not been very consistent about which packages we alias in various circumstances, and the aliases we use vary. In the spirit of the advice in the style guide and https://github.com/golang/go/wiki/CodeReviewComments#imports, his change makes an effort to clean up and normalize import aliasing. This change makes no API or behavioral changes. It is a pure cleanup intended o help make the code more readable to developers (including myself) trying to understand what is being imported where. Only unexported names have been modified, and the changes were generated and applied mechanically with gofmt -r and comby, respecting the lexical and syntactic rules of Go. Even so, I did not fix every inconsistency. Where the changes would be too disruptive, I left it alone. The principles I followed in this cleanup are: - Remove aliases that restate the package name. - Remove aliases where the base package name is unambiguous. - Move overly-terse abbreviations from the import to the usage site. - Fix lexical issues (remove underscores, remove capitalization). - Fix import groupings to more closely match the style guide. - Group blank (side-effecting) imports and ensure they are commented. - Add aliases to multiple imports with the same base package name.
3 years ago
cleanup: Reduce and normalize import path aliasing. (#6975) The code in the Tendermint repository makes heavy use of import aliasing. This is made necessary by our extensive reuse of common base package names, and by repetition of similar names across different subdirectories. Unfortunately we have not been very consistent about which packages we alias in various circumstances, and the aliases we use vary. In the spirit of the advice in the style guide and https://github.com/golang/go/wiki/CodeReviewComments#imports, his change makes an effort to clean up and normalize import aliasing. This change makes no API or behavioral changes. It is a pure cleanup intended o help make the code more readable to developers (including myself) trying to understand what is being imported where. Only unexported names have been modified, and the changes were generated and applied mechanically with gofmt -r and comby, respecting the lexical and syntactic rules of Go. Even so, I did not fix every inconsistency. Where the changes would be too disruptive, I left it alone. The principles I followed in this cleanup are: - Remove aliases that restate the package name. - Remove aliases where the base package name is unambiguous. - Move overly-terse abbreviations from the import to the usage site. - Fix lexical issues (remove underscores, remove capitalization). - Fix import groupings to more closely match the style guide. - Group blank (side-effecting) imports and ensure they are commented. - Add aliases to multiple imports with the same base package name.
3 years ago
cleanup: Reduce and normalize import path aliasing. (#6975) The code in the Tendermint repository makes heavy use of import aliasing. This is made necessary by our extensive reuse of common base package names, and by repetition of similar names across different subdirectories. Unfortunately we have not been very consistent about which packages we alias in various circumstances, and the aliases we use vary. In the spirit of the advice in the style guide and https://github.com/golang/go/wiki/CodeReviewComments#imports, his change makes an effort to clean up and normalize import aliasing. This change makes no API or behavioral changes. It is a pure cleanup intended o help make the code more readable to developers (including myself) trying to understand what is being imported where. Only unexported names have been modified, and the changes were generated and applied mechanically with gofmt -r and comby, respecting the lexical and syntactic rules of Go. Even so, I did not fix every inconsistency. Where the changes would be too disruptive, I left it alone. The principles I followed in this cleanup are: - Remove aliases that restate the package name. - Remove aliases where the base package name is unambiguous. - Move overly-terse abbreviations from the import to the usage site. - Fix lexical issues (remove underscores, remove capitalization). - Fix import groupings to more closely match the style guide. - Group blank (side-effecting) imports and ensure they are commented. - Add aliases to multiple imports with the same base package name.
3 years ago
cleanup: Reduce and normalize import path aliasing. (#6975) The code in the Tendermint repository makes heavy use of import aliasing. This is made necessary by our extensive reuse of common base package names, and by repetition of similar names across different subdirectories. Unfortunately we have not been very consistent about which packages we alias in various circumstances, and the aliases we use vary. In the spirit of the advice in the style guide and https://github.com/golang/go/wiki/CodeReviewComments#imports, his change makes an effort to clean up and normalize import aliasing. This change makes no API or behavioral changes. It is a pure cleanup intended o help make the code more readable to developers (including myself) trying to understand what is being imported where. Only unexported names have been modified, and the changes were generated and applied mechanically with gofmt -r and comby, respecting the lexical and syntactic rules of Go. Even so, I did not fix every inconsistency. Where the changes would be too disruptive, I left it alone. The principles I followed in this cleanup are: - Remove aliases that restate the package name. - Remove aliases where the base package name is unambiguous. - Move overly-terse abbreviations from the import to the usage site. - Fix lexical issues (remove underscores, remove capitalization). - Fix import groupings to more closely match the style guide. - Group blank (side-effecting) imports and ensure they are commented. - Add aliases to multiple imports with the same base package name.
3 years ago
cleanup: Reduce and normalize import path aliasing. (#6975) The code in the Tendermint repository makes heavy use of import aliasing. This is made necessary by our extensive reuse of common base package names, and by repetition of similar names across different subdirectories. Unfortunately we have not been very consistent about which packages we alias in various circumstances, and the aliases we use vary. In the spirit of the advice in the style guide and https://github.com/golang/go/wiki/CodeReviewComments#imports, his change makes an effort to clean up and normalize import aliasing. This change makes no API or behavioral changes. It is a pure cleanup intended o help make the code more readable to developers (including myself) trying to understand what is being imported where. Only unexported names have been modified, and the changes were generated and applied mechanically with gofmt -r and comby, respecting the lexical and syntactic rules of Go. Even so, I did not fix every inconsistency. Where the changes would be too disruptive, I left it alone. The principles I followed in this cleanup are: - Remove aliases that restate the package name. - Remove aliases where the base package name is unambiguous. - Move overly-terse abbreviations from the import to the usage site. - Fix lexical issues (remove underscores, remove capitalization). - Fix import groupings to more closely match the style guide. - Group blank (side-effecting) imports and ensure they are commented. - Add aliases to multiple imports with the same base package name.
3 years ago
cleanup: Reduce and normalize import path aliasing. (#6975) The code in the Tendermint repository makes heavy use of import aliasing. This is made necessary by our extensive reuse of common base package names, and by repetition of similar names across different subdirectories. Unfortunately we have not been very consistent about which packages we alias in various circumstances, and the aliases we use vary. In the spirit of the advice in the style guide and https://github.com/golang/go/wiki/CodeReviewComments#imports, his change makes an effort to clean up and normalize import aliasing. This change makes no API or behavioral changes. It is a pure cleanup intended o help make the code more readable to developers (including myself) trying to understand what is being imported where. Only unexported names have been modified, and the changes were generated and applied mechanically with gofmt -r and comby, respecting the lexical and syntactic rules of Go. Even so, I did not fix every inconsistency. Where the changes would be too disruptive, I left it alone. The principles I followed in this cleanup are: - Remove aliases that restate the package name. - Remove aliases where the base package name is unambiguous. - Move overly-terse abbreviations from the import to the usage site. - Fix lexical issues (remove underscores, remove capitalization). - Fix import groupings to more closely match the style guide. - Group blank (side-effecting) imports and ensure they are commented. - Add aliases to multiple imports with the same base package name.
3 years ago
cleanup: Reduce and normalize import path aliasing. (#6975) The code in the Tendermint repository makes heavy use of import aliasing. This is made necessary by our extensive reuse of common base package names, and by repetition of similar names across different subdirectories. Unfortunately we have not been very consistent about which packages we alias in various circumstances, and the aliases we use vary. In the spirit of the advice in the style guide and https://github.com/golang/go/wiki/CodeReviewComments#imports, his change makes an effort to clean up and normalize import aliasing. This change makes no API or behavioral changes. It is a pure cleanup intended o help make the code more readable to developers (including myself) trying to understand what is being imported where. Only unexported names have been modified, and the changes were generated and applied mechanically with gofmt -r and comby, respecting the lexical and syntactic rules of Go. Even so, I did not fix every inconsistency. Where the changes would be too disruptive, I left it alone. The principles I followed in this cleanup are: - Remove aliases that restate the package name. - Remove aliases where the base package name is unambiguous. - Move overly-terse abbreviations from the import to the usage site. - Fix lexical issues (remove underscores, remove capitalization). - Fix import groupings to more closely match the style guide. - Group blank (side-effecting) imports and ensure they are commented. - Add aliases to multiple imports with the same base package name.
3 years ago
cleanup: Reduce and normalize import path aliasing. (#6975) The code in the Tendermint repository makes heavy use of import aliasing. This is made necessary by our extensive reuse of common base package names, and by repetition of similar names across different subdirectories. Unfortunately we have not been very consistent about which packages we alias in various circumstances, and the aliases we use vary. In the spirit of the advice in the style guide and https://github.com/golang/go/wiki/CodeReviewComments#imports, his change makes an effort to clean up and normalize import aliasing. This change makes no API or behavioral changes. It is a pure cleanup intended o help make the code more readable to developers (including myself) trying to understand what is being imported where. Only unexported names have been modified, and the changes were generated and applied mechanically with gofmt -r and comby, respecting the lexical and syntactic rules of Go. Even so, I did not fix every inconsistency. Where the changes would be too disruptive, I left it alone. The principles I followed in this cleanup are: - Remove aliases that restate the package name. - Remove aliases where the base package name is unambiguous. - Move overly-terse abbreviations from the import to the usage site. - Fix lexical issues (remove underscores, remove capitalization). - Fix import groupings to more closely match the style guide. - Group blank (side-effecting) imports and ensure they are commented. - Add aliases to multiple imports with the same base package name.
3 years ago
cleanup: Reduce and normalize import path aliasing. (#6975) The code in the Tendermint repository makes heavy use of import aliasing. This is made necessary by our extensive reuse of common base package names, and by repetition of similar names across different subdirectories. Unfortunately we have not been very consistent about which packages we alias in various circumstances, and the aliases we use vary. In the spirit of the advice in the style guide and https://github.com/golang/go/wiki/CodeReviewComments#imports, his change makes an effort to clean up and normalize import aliasing. This change makes no API or behavioral changes. It is a pure cleanup intended o help make the code more readable to developers (including myself) trying to understand what is being imported where. Only unexported names have been modified, and the changes were generated and applied mechanically with gofmt -r and comby, respecting the lexical and syntactic rules of Go. Even so, I did not fix every inconsistency. Where the changes would be too disruptive, I left it alone. The principles I followed in this cleanup are: - Remove aliases that restate the package name. - Remove aliases where the base package name is unambiguous. - Move overly-terse abbreviations from the import to the usage site. - Fix lexical issues (remove underscores, remove capitalization). - Fix import groupings to more closely match the style guide. - Group blank (side-effecting) imports and ensure they are commented. - Add aliases to multiple imports with the same base package name.
3 years ago
cleanup: Reduce and normalize import path aliasing. (#6975) The code in the Tendermint repository makes heavy use of import aliasing. This is made necessary by our extensive reuse of common base package names, and by repetition of similar names across different subdirectories. Unfortunately we have not been very consistent about which packages we alias in various circumstances, and the aliases we use vary. In the spirit of the advice in the style guide and https://github.com/golang/go/wiki/CodeReviewComments#imports, his change makes an effort to clean up and normalize import aliasing. This change makes no API or behavioral changes. It is a pure cleanup intended o help make the code more readable to developers (including myself) trying to understand what is being imported where. Only unexported names have been modified, and the changes were generated and applied mechanically with gofmt -r and comby, respecting the lexical and syntactic rules of Go. Even so, I did not fix every inconsistency. Where the changes would be too disruptive, I left it alone. The principles I followed in this cleanup are: - Remove aliases that restate the package name. - Remove aliases where the base package name is unambiguous. - Move overly-terse abbreviations from the import to the usage site. - Fix lexical issues (remove underscores, remove capitalization). - Fix import groupings to more closely match the style guide. - Group blank (side-effecting) imports and ensure they are commented. - Add aliases to multiple imports with the same base package name.
3 years ago
cleanup: Reduce and normalize import path aliasing. (#6975) The code in the Tendermint repository makes heavy use of import aliasing. This is made necessary by our extensive reuse of common base package names, and by repetition of similar names across different subdirectories. Unfortunately we have not been very consistent about which packages we alias in various circumstances, and the aliases we use vary. In the spirit of the advice in the style guide and https://github.com/golang/go/wiki/CodeReviewComments#imports, his change makes an effort to clean up and normalize import aliasing. This change makes no API or behavioral changes. It is a pure cleanup intended o help make the code more readable to developers (including myself) trying to understand what is being imported where. Only unexported names have been modified, and the changes were generated and applied mechanically with gofmt -r and comby, respecting the lexical and syntactic rules of Go. Even so, I did not fix every inconsistency. Where the changes would be too disruptive, I left it alone. The principles I followed in this cleanup are: - Remove aliases that restate the package name. - Remove aliases where the base package name is unambiguous. - Move overly-terse abbreviations from the import to the usage site. - Fix lexical issues (remove underscores, remove capitalization). - Fix import groupings to more closely match the style guide. - Group blank (side-effecting) imports and ensure they are commented. - Add aliases to multiple imports with the same base package name.
3 years ago
cleanup: Reduce and normalize import path aliasing. (#6975) The code in the Tendermint repository makes heavy use of import aliasing. This is made necessary by our extensive reuse of common base package names, and by repetition of similar names across different subdirectories. Unfortunately we have not been very consistent about which packages we alias in various circumstances, and the aliases we use vary. In the spirit of the advice in the style guide and https://github.com/golang/go/wiki/CodeReviewComments#imports, his change makes an effort to clean up and normalize import aliasing. This change makes no API or behavioral changes. It is a pure cleanup intended o help make the code more readable to developers (including myself) trying to understand what is being imported where. Only unexported names have been modified, and the changes were generated and applied mechanically with gofmt -r and comby, respecting the lexical and syntactic rules of Go. Even so, I did not fix every inconsistency. Where the changes would be too disruptive, I left it alone. The principles I followed in this cleanup are: - Remove aliases that restate the package name. - Remove aliases where the base package name is unambiguous. - Move overly-terse abbreviations from the import to the usage site. - Fix lexical issues (remove underscores, remove capitalization). - Fix import groupings to more closely match the style guide. - Group blank (side-effecting) imports and ensure they are commented. - Add aliases to multiple imports with the same base package name.
3 years ago
cleanup: Reduce and normalize import path aliasing. (#6975) The code in the Tendermint repository makes heavy use of import aliasing. This is made necessary by our extensive reuse of common base package names, and by repetition of similar names across different subdirectories. Unfortunately we have not been very consistent about which packages we alias in various circumstances, and the aliases we use vary. In the spirit of the advice in the style guide and https://github.com/golang/go/wiki/CodeReviewComments#imports, his change makes an effort to clean up and normalize import aliasing. This change makes no API or behavioral changes. It is a pure cleanup intended o help make the code more readable to developers (including myself) trying to understand what is being imported where. Only unexported names have been modified, and the changes were generated and applied mechanically with gofmt -r and comby, respecting the lexical and syntactic rules of Go. Even so, I did not fix every inconsistency. Where the changes would be too disruptive, I left it alone. The principles I followed in this cleanup are: - Remove aliases that restate the package name. - Remove aliases where the base package name is unambiguous. - Move overly-terse abbreviations from the import to the usage site. - Fix lexical issues (remove underscores, remove capitalization). - Fix import groupings to more closely match the style guide. - Group blank (side-effecting) imports and ensure they are commented. - Add aliases to multiple imports with the same base package name.
3 years ago
cleanup: Reduce and normalize import path aliasing. (#6975) The code in the Tendermint repository makes heavy use of import aliasing. This is made necessary by our extensive reuse of common base package names, and by repetition of similar names across different subdirectories. Unfortunately we have not been very consistent about which packages we alias in various circumstances, and the aliases we use vary. In the spirit of the advice in the style guide and https://github.com/golang/go/wiki/CodeReviewComments#imports, his change makes an effort to clean up and normalize import aliasing. This change makes no API or behavioral changes. It is a pure cleanup intended o help make the code more readable to developers (including myself) trying to understand what is being imported where. Only unexported names have been modified, and the changes were generated and applied mechanically with gofmt -r and comby, respecting the lexical and syntactic rules of Go. Even so, I did not fix every inconsistency. Where the changes would be too disruptive, I left it alone. The principles I followed in this cleanup are: - Remove aliases that restate the package name. - Remove aliases where the base package name is unambiguous. - Move overly-terse abbreviations from the import to the usage site. - Fix lexical issues (remove underscores, remove capitalization). - Fix import groupings to more closely match the style guide. - Group blank (side-effecting) imports and ensure they are commented. - Add aliases to multiple imports with the same base package name.
3 years ago
cleanup: Reduce and normalize import path aliasing. (#6975) The code in the Tendermint repository makes heavy use of import aliasing. This is made necessary by our extensive reuse of common base package names, and by repetition of similar names across different subdirectories. Unfortunately we have not been very consistent about which packages we alias in various circumstances, and the aliases we use vary. In the spirit of the advice in the style guide and https://github.com/golang/go/wiki/CodeReviewComments#imports, his change makes an effort to clean up and normalize import aliasing. This change makes no API or behavioral changes. It is a pure cleanup intended o help make the code more readable to developers (including myself) trying to understand what is being imported where. Only unexported names have been modified, and the changes were generated and applied mechanically with gofmt -r and comby, respecting the lexical and syntactic rules of Go. Even so, I did not fix every inconsistency. Where the changes would be too disruptive, I left it alone. The principles I followed in this cleanup are: - Remove aliases that restate the package name. - Remove aliases where the base package name is unambiguous. - Move overly-terse abbreviations from the import to the usage site. - Fix lexical issues (remove underscores, remove capitalization). - Fix import groupings to more closely match the style guide. - Group blank (side-effecting) imports and ensure they are commented. - Add aliases to multiple imports with the same base package name.
3 years ago
cleanup: Reduce and normalize import path aliasing. (#6975) The code in the Tendermint repository makes heavy use of import aliasing. This is made necessary by our extensive reuse of common base package names, and by repetition of similar names across different subdirectories. Unfortunately we have not been very consistent about which packages we alias in various circumstances, and the aliases we use vary. In the spirit of the advice in the style guide and https://github.com/golang/go/wiki/CodeReviewComments#imports, his change makes an effort to clean up and normalize import aliasing. This change makes no API or behavioral changes. It is a pure cleanup intended o help make the code more readable to developers (including myself) trying to understand what is being imported where. Only unexported names have been modified, and the changes were generated and applied mechanically with gofmt -r and comby, respecting the lexical and syntactic rules of Go. Even so, I did not fix every inconsistency. Where the changes would be too disruptive, I left it alone. The principles I followed in this cleanup are: - Remove aliases that restate the package name. - Remove aliases where the base package name is unambiguous. - Move overly-terse abbreviations from the import to the usage site. - Fix lexical issues (remove underscores, remove capitalization). - Fix import groupings to more closely match the style guide. - Group blank (side-effecting) imports and ensure they are commented. - Add aliases to multiple imports with the same base package name.
3 years ago
cleanup: Reduce and normalize import path aliasing. (#6975) The code in the Tendermint repository makes heavy use of import aliasing. This is made necessary by our extensive reuse of common base package names, and by repetition of similar names across different subdirectories. Unfortunately we have not been very consistent about which packages we alias in various circumstances, and the aliases we use vary. In the spirit of the advice in the style guide and https://github.com/golang/go/wiki/CodeReviewComments#imports, his change makes an effort to clean up and normalize import aliasing. This change makes no API or behavioral changes. It is a pure cleanup intended o help make the code more readable to developers (including myself) trying to understand what is being imported where. Only unexported names have been modified, and the changes were generated and applied mechanically with gofmt -r and comby, respecting the lexical and syntactic rules of Go. Even so, I did not fix every inconsistency. Where the changes would be too disruptive, I left it alone. The principles I followed in this cleanup are: - Remove aliases that restate the package name. - Remove aliases where the base package name is unambiguous. - Move overly-terse abbreviations from the import to the usage site. - Fix lexical issues (remove underscores, remove capitalization). - Fix import groupings to more closely match the style guide. - Group blank (side-effecting) imports and ensure they are commented. - Add aliases to multiple imports with the same base package name.
3 years ago
cleanup: Reduce and normalize import path aliasing. (#6975) The code in the Tendermint repository makes heavy use of import aliasing. This is made necessary by our extensive reuse of common base package names, and by repetition of similar names across different subdirectories. Unfortunately we have not been very consistent about which packages we alias in various circumstances, and the aliases we use vary. In the spirit of the advice in the style guide and https://github.com/golang/go/wiki/CodeReviewComments#imports, his change makes an effort to clean up and normalize import aliasing. This change makes no API or behavioral changes. It is a pure cleanup intended o help make the code more readable to developers (including myself) trying to understand what is being imported where. Only unexported names have been modified, and the changes were generated and applied mechanically with gofmt -r and comby, respecting the lexical and syntactic rules of Go. Even so, I did not fix every inconsistency. Where the changes would be too disruptive, I left it alone. The principles I followed in this cleanup are: - Remove aliases that restate the package name. - Remove aliases where the base package name is unambiguous. - Move overly-terse abbreviations from the import to the usage site. - Fix lexical issues (remove underscores, remove capitalization). - Fix import groupings to more closely match the style guide. - Group blank (side-effecting) imports and ensure they are commented. - Add aliases to multiple imports with the same base package name.
3 years ago
  1. package node
  2. import (
  3. "bytes"
  4. "context"
  5. "errors"
  6. "fmt"
  7. "strings"
  8. "time"
  9. dbm "github.com/tendermint/tm-db"
  10. "github.com/tendermint/tendermint/config"
  11. "github.com/tendermint/tendermint/crypto"
  12. "github.com/tendermint/tendermint/internal/blocksync"
  13. "github.com/tendermint/tendermint/internal/consensus"
  14. "github.com/tendermint/tendermint/internal/eventbus"
  15. "github.com/tendermint/tendermint/internal/evidence"
  16. "github.com/tendermint/tendermint/internal/mempool"
  17. "github.com/tendermint/tendermint/internal/p2p"
  18. "github.com/tendermint/tendermint/internal/p2p/conn"
  19. "github.com/tendermint/tendermint/internal/p2p/pex"
  20. "github.com/tendermint/tendermint/internal/proxy"
  21. sm "github.com/tendermint/tendermint/internal/state"
  22. "github.com/tendermint/tendermint/internal/state/indexer"
  23. "github.com/tendermint/tendermint/internal/state/indexer/sink"
  24. "github.com/tendermint/tendermint/internal/statesync"
  25. "github.com/tendermint/tendermint/internal/store"
  26. "github.com/tendermint/tendermint/libs/log"
  27. "github.com/tendermint/tendermint/libs/service"
  28. tmstrings "github.com/tendermint/tendermint/libs/strings"
  29. "github.com/tendermint/tendermint/types"
  30. "github.com/tendermint/tendermint/version"
  31. _ "net/http/pprof" // nolint: gosec // securely exposed on separate, optional port
  32. )
  33. type closer func() error
  34. func makeCloser(cs []closer) closer {
  35. return func() error {
  36. errs := make([]string, 0, len(cs))
  37. for _, cl := range cs {
  38. if err := cl(); err != nil {
  39. errs = append(errs, err.Error())
  40. }
  41. }
  42. if len(errs) >= 0 {
  43. return errors.New(strings.Join(errs, "; "))
  44. }
  45. return nil
  46. }
  47. }
  48. func convertCancelCloser(cancel context.CancelFunc) closer {
  49. return func() error { cancel(); return nil }
  50. }
  51. func combineCloseError(err error, cl closer) error {
  52. if err == nil {
  53. return cl()
  54. }
  55. clerr := cl()
  56. if clerr == nil {
  57. return err
  58. }
  59. return fmt.Errorf("error=%q closerError=%q", err.Error(), clerr.Error())
  60. }
  61. func initDBs(
  62. cfg *config.Config,
  63. dbProvider config.DBProvider,
  64. ) (*store.BlockStore, dbm.DB, closer, error) {
  65. blockStoreDB, err := dbProvider(&config.DBContext{ID: "blockstore", Config: cfg})
  66. if err != nil {
  67. return nil, nil, func() error { return nil }, fmt.Errorf("unable to initialize blockstore: %w", err)
  68. }
  69. closers := []closer{}
  70. blockStore := store.NewBlockStore(blockStoreDB)
  71. closers = append(closers, blockStoreDB.Close)
  72. stateDB, err := dbProvider(&config.DBContext{ID: "state", Config: cfg})
  73. if err != nil {
  74. return nil, nil, makeCloser(closers), fmt.Errorf("unable to initialize statestore: %w", err)
  75. }
  76. closers = append(closers, stateDB.Close)
  77. return blockStore, stateDB, makeCloser(closers), nil
  78. }
  79. func createAndStartIndexerService(
  80. ctx context.Context,
  81. cfg *config.Config,
  82. dbProvider config.DBProvider,
  83. eventBus *eventbus.EventBus,
  84. logger log.Logger,
  85. chainID string,
  86. metrics *indexer.Metrics,
  87. ) (*indexer.Service, []indexer.EventSink, error) {
  88. eventSinks, err := sink.EventSinksFromConfig(cfg, dbProvider, chainID)
  89. if err != nil {
  90. return nil, nil, err
  91. }
  92. indexerService := indexer.NewService(indexer.ServiceArgs{
  93. Sinks: eventSinks,
  94. EventBus: eventBus,
  95. Logger: logger.With("module", "txindex"),
  96. Metrics: metrics,
  97. })
  98. if err := indexerService.Start(ctx); err != nil {
  99. return nil, nil, err
  100. }
  101. return indexerService, eventSinks, nil
  102. }
  103. func logNodeStartupInfo(state sm.State, pubKey crypto.PubKey, logger log.Logger, mode string) {
  104. // Log the version info.
  105. logger.Info("Version info",
  106. "tmVersion", version.TMVersion,
  107. "block", version.BlockProtocol,
  108. "p2p", version.P2PProtocol,
  109. "mode", mode,
  110. )
  111. // If the state and software differ in block version, at least log it.
  112. if state.Version.Consensus.Block != version.BlockProtocol {
  113. logger.Info("Software and state have different block protocols",
  114. "software", version.BlockProtocol,
  115. "state", state.Version.Consensus.Block,
  116. )
  117. }
  118. switch mode {
  119. case config.ModeFull:
  120. logger.Info("This node is a fullnode")
  121. case config.ModeValidator:
  122. addr := pubKey.Address()
  123. // Log whether this node is a validator or an observer
  124. if state.Validators.HasAddress(addr) {
  125. logger.Info("This node is a validator",
  126. "addr", addr,
  127. "pubKey", pubKey.Bytes(),
  128. )
  129. } else {
  130. logger.Info("This node is a validator (NOT in the active validator set)",
  131. "addr", addr,
  132. "pubKey", pubKey.Bytes(),
  133. )
  134. }
  135. }
  136. }
  137. func onlyValidatorIsUs(state sm.State, pubKey crypto.PubKey) bool {
  138. if state.Validators.Size() > 1 {
  139. return false
  140. }
  141. addr, _ := state.Validators.GetByIndex(0)
  142. return pubKey != nil && bytes.Equal(pubKey.Address(), addr)
  143. }
  144. func createMempoolReactor(
  145. ctx context.Context,
  146. cfg *config.Config,
  147. proxyApp proxy.AppConns,
  148. state sm.State,
  149. memplMetrics *mempool.Metrics,
  150. peerManager *p2p.PeerManager,
  151. router *p2p.Router,
  152. logger log.Logger,
  153. ) (service.Service, mempool.Mempool, error) {
  154. logger = logger.With("module", "mempool")
  155. mp := mempool.NewTxMempool(
  156. logger,
  157. cfg.Mempool,
  158. proxyApp.Mempool(),
  159. state.LastBlockHeight,
  160. mempool.WithMetrics(memplMetrics),
  161. mempool.WithPreCheck(sm.TxPreCheck(state)),
  162. mempool.WithPostCheck(sm.TxPostCheck(state)),
  163. )
  164. reactor, err := mempool.NewReactor(
  165. ctx,
  166. logger,
  167. cfg.Mempool,
  168. peerManager,
  169. mp,
  170. router.OpenChannel,
  171. peerManager.Subscribe(ctx),
  172. )
  173. if err != nil {
  174. return nil, nil, err
  175. }
  176. if cfg.Consensus.WaitForTxs() {
  177. mp.EnableTxsAvailable()
  178. }
  179. return reactor, mp, nil
  180. }
  181. func createEvidenceReactor(
  182. ctx context.Context,
  183. cfg *config.Config,
  184. dbProvider config.DBProvider,
  185. stateDB dbm.DB,
  186. blockStore *store.BlockStore,
  187. peerManager *p2p.PeerManager,
  188. router *p2p.Router,
  189. logger log.Logger,
  190. ) (*evidence.Reactor, *evidence.Pool, error) {
  191. evidenceDB, err := dbProvider(&config.DBContext{ID: "evidence", Config: cfg})
  192. if err != nil {
  193. return nil, nil, fmt.Errorf("unable to initialize evidence db: %w", err)
  194. }
  195. logger = logger.With("module", "evidence")
  196. evidencePool, err := evidence.NewPool(logger, evidenceDB, sm.NewStore(stateDB), blockStore)
  197. if err != nil {
  198. return nil, nil, fmt.Errorf("creating evidence pool: %w", err)
  199. }
  200. evidenceReactor, err := evidence.NewReactor(
  201. ctx,
  202. logger,
  203. router.OpenChannel,
  204. peerManager.Subscribe(ctx),
  205. evidencePool,
  206. )
  207. if err != nil {
  208. return nil, nil, fmt.Errorf("creating evidence reactor: %w", err)
  209. }
  210. return evidenceReactor, evidencePool, nil
  211. }
  212. func createConsensusReactor(
  213. ctx context.Context,
  214. cfg *config.Config,
  215. state sm.State,
  216. blockExec *sm.BlockExecutor,
  217. blockStore sm.BlockStore,
  218. mp mempool.Mempool,
  219. evidencePool *evidence.Pool,
  220. privValidator types.PrivValidator,
  221. csMetrics *consensus.Metrics,
  222. waitSync bool,
  223. eventBus *eventbus.EventBus,
  224. peerManager *p2p.PeerManager,
  225. router *p2p.Router,
  226. logger log.Logger,
  227. ) (*consensus.Reactor, *consensus.State, error) {
  228. logger = logger.With("module", "consensus")
  229. consensusState := consensus.NewState(ctx,
  230. logger,
  231. cfg.Consensus,
  232. state.Copy(),
  233. blockExec,
  234. blockStore,
  235. mp,
  236. evidencePool,
  237. consensus.StateMetrics(csMetrics),
  238. )
  239. if privValidator != nil && cfg.Mode == config.ModeValidator {
  240. consensusState.SetPrivValidator(ctx, privValidator)
  241. }
  242. reactor, err := consensus.NewReactor(
  243. ctx,
  244. logger,
  245. consensusState,
  246. router.OpenChannel,
  247. peerManager.Subscribe(ctx),
  248. waitSync,
  249. csMetrics,
  250. )
  251. if err != nil {
  252. return nil, nil, err
  253. }
  254. // Services which will be publishing and/or subscribing for messages (events)
  255. // consensusReactor will set it on consensusState and blockExecutor.
  256. reactor.SetEventBus(eventBus)
  257. return reactor, consensusState, nil
  258. }
  259. func createPeerManager(
  260. cfg *config.Config,
  261. dbProvider config.DBProvider,
  262. nodeID types.NodeID,
  263. ) (*p2p.PeerManager, closer, error) {
  264. privatePeerIDs := make(map[types.NodeID]struct{})
  265. for _, id := range tmstrings.SplitAndTrimEmpty(cfg.P2P.PrivatePeerIDs, ",", " ") {
  266. privatePeerIDs[types.NodeID(id)] = struct{}{}
  267. }
  268. var maxConns uint16
  269. switch {
  270. case cfg.P2P.MaxConnections > 0:
  271. maxConns = cfg.P2P.MaxConnections
  272. default:
  273. maxConns = 64
  274. }
  275. options := p2p.PeerManagerOptions{
  276. MaxConnected: maxConns,
  277. MaxConnectedUpgrade: 4,
  278. MaxPeers: 1000,
  279. MinRetryTime: 100 * time.Millisecond,
  280. MaxRetryTime: 8 * time.Hour,
  281. MaxRetryTimePersistent: 5 * time.Minute,
  282. RetryTimeJitter: 3 * time.Second,
  283. PrivatePeers: privatePeerIDs,
  284. }
  285. peers := []p2p.NodeAddress{}
  286. for _, p := range tmstrings.SplitAndTrimEmpty(cfg.P2P.PersistentPeers, ",", " ") {
  287. address, err := p2p.ParseNodeAddress(p)
  288. if err != nil {
  289. return nil, func() error { return nil }, fmt.Errorf("invalid peer address %q: %w", p, err)
  290. }
  291. peers = append(peers, address)
  292. options.PersistentPeers = append(options.PersistentPeers, address.NodeID)
  293. }
  294. for _, p := range tmstrings.SplitAndTrimEmpty(cfg.P2P.BootstrapPeers, ",", " ") {
  295. address, err := p2p.ParseNodeAddress(p)
  296. if err != nil {
  297. return nil, func() error { return nil }, fmt.Errorf("invalid peer address %q: %w", p, err)
  298. }
  299. peers = append(peers, address)
  300. }
  301. peerDB, err := dbProvider(&config.DBContext{ID: "peerstore", Config: cfg})
  302. if err != nil {
  303. return nil, func() error { return nil }, fmt.Errorf("unable to initialize peer store: %w", err)
  304. }
  305. peerManager, err := p2p.NewPeerManager(nodeID, peerDB, options)
  306. if err != nil {
  307. return nil, peerDB.Close, fmt.Errorf("failed to create peer manager: %w", err)
  308. }
  309. for _, peer := range peers {
  310. if _, err := peerManager.Add(peer); err != nil {
  311. return nil, peerDB.Close, fmt.Errorf("failed to add peer %q: %w", peer, err)
  312. }
  313. }
  314. return peerManager, peerDB.Close, nil
  315. }
  316. func createRouter(
  317. ctx context.Context,
  318. logger log.Logger,
  319. p2pMetrics *p2p.Metrics,
  320. nodeInfo types.NodeInfo,
  321. nodeKey types.NodeKey,
  322. peerManager *p2p.PeerManager,
  323. cfg *config.Config,
  324. proxyApp proxy.AppConns,
  325. ) (*p2p.Router, error) {
  326. p2pLogger := logger.With("module", "p2p")
  327. transportConf := conn.DefaultMConnConfig()
  328. transportConf.FlushThrottle = cfg.P2P.FlushThrottleTimeout
  329. transportConf.SendRate = cfg.P2P.SendRate
  330. transportConf.RecvRate = cfg.P2P.RecvRate
  331. transportConf.MaxPacketMsgPayloadSize = cfg.P2P.MaxPacketMsgPayloadSize
  332. transport := p2p.NewMConnTransport(
  333. p2pLogger, transportConf, []*p2p.ChannelDescriptor{},
  334. p2p.MConnTransportOptions{
  335. MaxAcceptedConnections: uint32(cfg.P2P.MaxConnections),
  336. },
  337. )
  338. ep, err := p2p.NewEndpoint(nodeKey.ID.AddressString(cfg.P2P.ListenAddress))
  339. if err != nil {
  340. return nil, err
  341. }
  342. return p2p.NewRouter(
  343. ctx,
  344. p2pLogger,
  345. p2pMetrics,
  346. nodeInfo,
  347. nodeKey.PrivKey,
  348. peerManager,
  349. []p2p.Transport{transport},
  350. []p2p.Endpoint{ep},
  351. getRouterConfig(cfg, proxyApp),
  352. )
  353. }
  354. func makeNodeInfo(
  355. cfg *config.Config,
  356. nodeKey types.NodeKey,
  357. eventSinks []indexer.EventSink,
  358. genDoc *types.GenesisDoc,
  359. state sm.State,
  360. ) (types.NodeInfo, error) {
  361. txIndexerStatus := "off"
  362. if indexer.IndexingEnabled(eventSinks) {
  363. txIndexerStatus = "on"
  364. }
  365. nodeInfo := types.NodeInfo{
  366. ProtocolVersion: types.ProtocolVersion{
  367. P2P: version.P2PProtocol, // global
  368. Block: state.Version.Consensus.Block,
  369. App: state.Version.Consensus.App,
  370. },
  371. NodeID: nodeKey.ID,
  372. Network: genDoc.ChainID,
  373. Version: version.TMVersion,
  374. Channels: []byte{
  375. byte(blocksync.BlockSyncChannel),
  376. byte(consensus.StateChannel),
  377. byte(consensus.DataChannel),
  378. byte(consensus.VoteChannel),
  379. byte(consensus.VoteSetBitsChannel),
  380. byte(mempool.MempoolChannel),
  381. byte(evidence.EvidenceChannel),
  382. byte(statesync.SnapshotChannel),
  383. byte(statesync.ChunkChannel),
  384. byte(statesync.LightBlockChannel),
  385. byte(statesync.ParamsChannel),
  386. },
  387. Moniker: cfg.Moniker,
  388. Other: types.NodeInfoOther{
  389. TxIndex: txIndexerStatus,
  390. RPCAddress: cfg.RPC.ListenAddress,
  391. },
  392. }
  393. if cfg.P2P.PexReactor {
  394. nodeInfo.Channels = append(nodeInfo.Channels, pex.PexChannel)
  395. }
  396. nodeInfo.ListenAddr = cfg.P2P.ExternalAddress
  397. if nodeInfo.ListenAddr == "" {
  398. nodeInfo.ListenAddr = cfg.P2P.ListenAddress
  399. }
  400. return nodeInfo, nodeInfo.Validate()
  401. }
  402. func makeSeedNodeInfo(
  403. cfg *config.Config,
  404. nodeKey types.NodeKey,
  405. genDoc *types.GenesisDoc,
  406. state sm.State,
  407. ) (types.NodeInfo, error) {
  408. nodeInfo := types.NodeInfo{
  409. ProtocolVersion: types.ProtocolVersion{
  410. P2P: version.P2PProtocol, // global
  411. Block: state.Version.Consensus.Block,
  412. App: state.Version.Consensus.App,
  413. },
  414. NodeID: nodeKey.ID,
  415. Network: genDoc.ChainID,
  416. Version: version.TMVersion,
  417. Channels: []byte{},
  418. Moniker: cfg.Moniker,
  419. Other: types.NodeInfoOther{
  420. TxIndex: "off",
  421. RPCAddress: cfg.RPC.ListenAddress,
  422. },
  423. }
  424. if cfg.P2P.PexReactor {
  425. nodeInfo.Channels = append(nodeInfo.Channels, pex.PexChannel)
  426. }
  427. nodeInfo.ListenAddr = cfg.P2P.ExternalAddress
  428. if nodeInfo.ListenAddr == "" {
  429. nodeInfo.ListenAddr = cfg.P2P.ListenAddress
  430. }
  431. return nodeInfo, nodeInfo.Validate()
  432. }